From owner-freebsd-questions@FreeBSD.ORG Sun Mar 14 16:18:35 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C7D9516A4CE for ; Sun, 14 Mar 2004 16:18:35 -0800 (PST) Received: from post.web.ca (post.web.ca [192.139.37.29]) by mx1.FreeBSD.org (Postfix) with ESMTP id 92C1A43D3F for ; Sun, 14 Mar 2004 16:18:35 -0800 (PST) (envelope-from rob@web.ca) Received: by post.web.ca (Postfix, from userid 1001) id CA6E95D35; Sun, 14 Mar 2004 19:18:34 -0500 (EST) Date: Sun, 14 Mar 2004 19:18:34 -0500 From: Rob Ellis To: freebsd-questions@freebsd.org Message-ID: <20040315001834.GA9303@web.ca> Mail-Followup-To: Rob Ellis , freebsd-questions@freebsd.org References: <4054DD10.5060504@stevenfettig.com> <20040314164347.X35552@wonkity.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040314164347.X35552@wonkity.com> User-Agent: Mutt/1.4.1i Subject: Re: [OT] sed question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2004 00:18:35 -0000 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