Article View: comp.unix
Article #280Re: getting sed to put linefeed in output stream
From: Bill Campbell
Date: Wed, 17 Oct 1990 16:35
Date: Wed, 17 Oct 1990 16:35
24 lines
1465 bytes
1465 bytes
In article <2199@megadon.UUCP> bm@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@Celestial.COM Bill Campbell; Celestial Software
UUCP: ...!thebes!camco!bill 6641 East Mercer Way
uunet!camco!bill Mercer Island, WA 98040; (206) 947-5591
Technical Details
Message-ID:
<2220@megadon.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!altos!megadon!clpReferences:
<3713@zorba.Tynan.COM> <2199@megadon.UUCP>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!apple!altos!megadon!clp From: bill@camco.Celestial.COM (Bill Campbell) Newsgroups: comp.unix Subject: Re: getting sed to put linefeed in output stream Keywords: malloc, free, sbrk, heap, swap Message-ID: <2220@megadon.UUCP> Date: 17 Oct 90 16:35:24 GMT References: <3713@zorba.Tynan.COM> <2199@megadon.UUCP> Sender: clp@megadon.UUCP Organization: Celestial Software, Mercer Island, WA Lines: 24 Approved: clp@megadon.UUCP Return-Path: <hpubvwa!camco!bill>