From j@itntl.bhp.com.au Mon Jul 14 11:49:06 1997 Path: fu-berlin.de!news.apfel.de!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news-xfer.netaxs.com!newsfeeds.sol.net!sol.net!spool.mu.edu!newsspool.sol.net!munnari.OZ.AU!metro!metro!seagoon.newcastle.edu.au!not-for-mail From: j@itntl.bhp.com.au (Jason Tyler) Newsgroups: comp.editors Subject: Re: inserting a newline w/ sed Date: 13 Jul 1997 05:56:31 GMT Organization: 742 Evergreen Terrace Lines: 23 Distribution: inet Message-ID: <5q9qmf$iun@seagoon.newcastle.edu.au> References: <5q3gq9$1g58$1@ausnews.austin.ibm.com> NNTP-Posting-Host: alinga.newcastle.edu.au X-Newsreader: TIN [UNIX 1.3 950824BETA PL0] Todd Hartman (thartman@austin.ibm.com) wrote: : Can anybody tell me the best way to insert a newline with sed? : : Say I want to take the matching pattern and put it on a line of its own. This script puts newlines around lines containing "jason": sed '/jason/{ a\ . i\ . }' See the man page for descriptions of the 'a' and 'i' commands. : Sed doesn't know what \n is (as far as I can tell). I think it does, but iff the '\n' appears in a regular expression. -- Jason Tyler | I lost my compiler. j@itntl.bhp.com.au | Long time, no C.