I was curious to know if there is a better way to sed
two words and add a line before and after them.
I learned how from grymoire but I wanted to know if there was a better way to do:
#!/bin/sh
sed '
/foo/,/bar/ {
i\
Add this line before
a\
Add this line after
}'
What I am trying to do is find two words on one line, in this case foo
and bar
and then add something on the line before and the line after.
If its not to much trouble or off-topic, can some recommend in the comments a few other sites to read on sed
other than grymoire?
awk is easier, IMO