Date: Sun, 14 Mar 2004 16:50:40 -0700 (MST) From: Warren Block <wblock@wonkity.com> To: "Steven N. Fettig" <freebsd@stevenfettig.com> Cc: freebsd-questions@freebsd.org Subject: Re: [OT] sed question Message-ID: <20040314164347.X35552@wonkity.com> In-Reply-To: <4054DD10.5060504@stevenfettig.com> References: <4054DD10.5060504@stevenfettig.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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. perl -pe 's/ /\n/g' my_test_text_document.txt which actually would be better as perl -pe 's/\s./\n/g' my_test_text_document.txt -Warren Block * Rapid City, South Dakota USA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040314164347.X35552>