Let say pattern is string "Love"
input
This is some text
Love this or that
He is running like a rabbit
output
This is some text
Love this or thatHe is running like a rabbit
I've noticed that sed is very unpleasant for deleting newline characters, any idea?
sed
works on one line at a time. Every time it starts to work on a line it removes the new line and places it on pattern space. Pattern space is where all the action takes place. Once the substitution is done it places the newline and prints toSTDOUT
. To remove new line you need to useN
which appends the next line to pattern space separated by\n
which you can then remove with substitution. – Hostetterthat
andHe
? – Zymogenic