Date: Tue, 18 Jun 2002 09:36:30 -0400 From: Brian T.Schellenberger <bts@babbleon.org> To: Jacob Rhoden <f3z@iprimus.com.au>, freebsd-questions@FreeBSD.ORG Subject: Re: OT: using sed to insert \n at command line Message-ID: <20020618133630.7C6C8BB2C@i8k.babbleon.org> In-Reply-To: <5.1.1.6.0.20020618161418.020a7780@wheresmymailserver.com> References: <5.1.1.6.0.20020618161418.020a7780@wheresmymailserver.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020618133630.7C6C8BB2C>