In my company style guide it says that bash scripts cannot be longer than 80 lines. So I have this gigantic sed substitution over twice as long. How can I break it into more lines so that it still works? I have
sed -i s/AAAAA...AAA/BBBBB...BBB/g
And I want something like
sed -i s/AAAAA...AAA/
BBBBB...BBB/g
still having the same effect.
Possible ways to clean up
1) Put your sed script into a file
2) Use Regex shorthand
3) Use Bash variables to help break it up a bit
What not to do
1) Escape the newline to break it up into multiple lines.
You will end up with a newline in your sed script that you don’t want.