Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Mar 2004 16:46:24 -0800
From:      Bill Campbell <freebsd@celestial.com>
To:        "Steven N. Fettig" <freebsd@stevenfettig.com>, freebsd-questions@freebsd.org
Subject:   Re: [OT] sed question
Message-ID:  <20040315004624.GA82408@alexis.mi.celestial.com>
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, 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.

I thought it was the other way around, that the gnu version of
sed accepts the standard ``C'' escape sequences, but the FreeBSD
version doesn't.  I always use the gnu tools configured with the
program-prefix='g' option, and referenced as ``gsed'' rather than
depending the the native ``sed'' doing what I expect.

Bill
--
INTERNET:   bill@Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Never chastise a Windows user...just smile at them kindly as you would a
disadvantaged child.'' WBM



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040315004624.GA82408>