sed - match newlines on input (Oops+Fix)
ras1 at mtuxo.UUCP
ras1 at mtuxo.UUCP
Thu Mar 12 11:49:04 AEST 1987
>> s/one\ntwo\nthree/one, two, three/g
The previously posted examples fail for:
... OR ...
abc abc
abc 123
123 abc
xyz 123
... xyz
...
# A "better" approach might be:
sed -n "
:top
/^abc$/{h; n
/^123$/!b top
{H; n; /^xyz$/!b top
H; g; s/\n/, /gp;}
}" ${*:-}
#enuf grotesque mucking around w/sed:-)
Dick Stewart; ihnp4!tarpon!stewart; ATT-IS: DISCLAIMER !!!
More information about the Comp.unix.questions
mailing list