getting sed to put linefeed in output stream
Bill Campbell
bill at camco.Celestial.COM
Thu Oct 18 02:35:24 AEST 1990
In article <2199 at megadon.UUCP> bm at bike2work.Eng.Sun.COM (Bill Michel) writes:
:I want to put a newline in my output with sed. Something like
:
:sed "/NAME */NAME \n/" inputfile
:
:in other words, replace each occurrence of NAME followed by one or more
:spaces with NAME followed by a newline. \n doesn't quite seem to do
:it, however, and I get a literal "n" in my output. I have been able
:to embed a carriage return (^M) but not a linefeed (it doesn't show
:up as a control character, but rather, breaks the line in the script.
:
:HELP!
One way to do this is:
sed '
s/NAME */NAME\
/g
' inputfile
The backslash at the end of the line escapes the newline.
--
INTERNET: bill at Celestial.COM Bill Campbell; Celestial Software
UUCP: ...!thebes!camco!bill 6641 East Mercer Way
uunet!camco!bill Mercer Island, WA 98040; (206) 947-5591
More information about the Comp.unix
mailing list