From owner-freebsd-questions@FreeBSD.ORG Sun Mar 14 15:50:42 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 810FF16A4D1 for ; Sun, 14 Mar 2004 15:50:42 -0800 (PST) Received: from wonkity.com (wonkity.com [65.173.111.5]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2436C43D39 for ; Sun, 14 Mar 2004 15:50:42 -0800 (PST) (envelope-from wblock@wonkity.com) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.12.11/8.12.11) with ESMTP id i2ENof1R053976; Sun, 14 Mar 2004 16:50:41 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.12.11/8.12.11/Submit) with ESMTP id i2ENofYu053973; Sun, 14 Mar 2004 16:50:41 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Sun, 14 Mar 2004 16:50:40 -0700 (MST) From: Warren Block To: "Steven N. Fettig" In-Reply-To: <4054DD10.5060504@stevenfettig.com> Message-ID: <20040314164347.X35552@wonkity.com> References: <4054DD10.5060504@stevenfettig.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-questions@freebsd.org 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: Sun, 14 Mar 2004 23:50:42 -0000 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