How to add a line break in a pipe-received output, using sed, only for cases that fit the established pattern?
I used sed "s/.*oo.*/&\n/"
to no avail. The default is OK, but the addition of the new line does not. I need to know what to put there where it is \n
.
Examples of results I hope:
No Match:
echo 'bravo bar' | sed "s/.*oo.*/&\n/"
Expected output:
bravo bar
Match:
echo 'foo bar' | sed "s/.*oo.*/&\n/"
Expected output:
foo
bar