Date: Sun, 14 Mar 2004 19:18:34 -0500 From: Rob Ellis <rob@web.ca> To: freebsd-questions@freebsd.org Subject: Re: [OT] sed question Message-ID: <20040315001834.GA9303@web.ca> In-Reply-To: <20040314164347.X35552@wonkity.com> References: <4054DD10.5060504@stevenfettig.com> <20040314164347.X35552@wonkity.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Mar 14, 2004 at 04:50:40PM -0700, Warren Block wrote: > On Sun, 14 Mar 2004, Steven N. Fettig wrote: > > > I can't figure out what the newline character is... I've tried \n \r &\, > > etc. with no avail. I run the following: > > > > sed 's/[ ]/\n/g' my_test_text_document.txt > > >From the sed man page: > > "2. The escape sequence \n matches a newline character embedded in > the pattern space. You can't, however, use a literal newline > character in an address or in the substitute command." > > I think this is a BSD thing, and sed on other systems does handle \n and > other literals in substitutions. It's annoying enough that I just use > Perl instead. > This works with sed in /bin/sh and ksh: sed -e 's/ */\ /g' my_test_text_document.txt I.e., escape an actual newline. Two spaces before the '*'. It doesn't work in csh. Don't know why... - Rob
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040315001834.GA9303>