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?
You can use this:
sed '/^Love/{N;s/\n//;}' love.txt
details:
/^Love/
identifies the line to treat, if you like you can use /[Ll]ove/
instead
N
adds the next line to the pattern space. After this command the pattern space contains Love this or that\nHe is running like a rabbit
s/\n//
replaces the newline character