From owner-freebsd-questions Tue Jun 18 8:51:45 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mail4.nc.rr.com (fe4.southeast.rr.com [24.93.67.51]) by hub.freebsd.org (Postfix) with ESMTP id 9F0C737B400 for ; Tue, 18 Jun 2002 08:51:40 -0700 (PDT) Received: from i8k.babbleon.org ([66.57.86.84]) by mail4.nc.rr.com with Microsoft SMTPSVC(5.5.1877.757.75); Tue, 18 Jun 2002 09:36:39 -0400 Received: by i8k.babbleon.org (Postfix, from userid 111) id 7C6C8BB2C; Tue, 18 Jun 2002 09:36:30 -0400 (EDT) Content-Type: text/plain; charset="iso-8859-1" From: Brian T.Schellenberger To: Jacob Rhoden , freebsd-questions@FreeBSD.ORG Subject: Re: OT: using sed to insert \n at command line Date: Tue, 18 Jun 2002 09:36:30 -0400 X-Mailer: KMail [version 1.3] References: <5.1.1.6.0.20020618161418.020a7780@wheresmymailserver.com> In-Reply-To: <5.1.1.6.0.20020618161418.020a7780@wheresmymailserver.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-Id: <20020618133630.7C6C8BB2C@i8k.babbleon.org> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tuesday 18 June 2002 02:16 am, Jacob Rhoden wrote: | Hi, | | Ive done some searching online and I cant work out how to do this, and I | was wondering if any of you guys do? This is what I am doing, and when I | try to insert a \n it doesnt work either way: | | input | sed 's/a string/\n/g' | output | input | sed 's/a string/\\n/g' | output | | what is the correct way from the command prompt? Thanks for any help . . In csh, at least, this is works: % echo this is a string to test | sed 's/a string/\\ /g' | cat this is to test Sed never uses \n for newline, it always uses an actual newline, escaped to prevent it being interpretted to terminate the line. The only problem in the shell is that the shell is using the same convention so you have to get the newlines properly escaped to both. Other shells may require different numbers of escapes, but the idea should be similar. | | Regards, | Jacob | | | To Unsubscribe: send mail to majordomo@FreeBSD.org | with "unsubscribe freebsd-questions" in the body of the message -- Brian T. Schellenberger . . . . . . . bts@wnt.sas.com (work) Brian, the man from Babble-On . . . . bts@babbleon.org (personal) http://www.babbleon.org http://www.eff.org http://www.programming-freedom.org If you smell the smoke you don't need to be told what you've got to do; Yet there's a certain breed, so very in-between, they'd rather take a vote. -- DEVO -- Here To Go To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message