From owner-freebsd-questions Wed Dec 30 04:22:48 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA10082 for freebsd-questions-outgoing; Wed, 30 Dec 1998 04:22:48 -0800 (PST) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from smtp1.vnet.net (smtp1.vnet.net [166.82.1.31]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA10049 for ; Wed, 30 Dec 1998 04:22:45 -0800 (PST) (envelope-from rivers@dignus.com) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp1.vnet.net (8.9.1a/8.9.1) with ESMTP id HAA19539; Wed, 30 Dec 1998 07:22:46 -0500 (EST) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.1/8.8.5) with ESMTP id IAA16982; Wed, 30 Dec 1998 08:06:09 -0500 (EST) Received: (from rivers@localhost) by lakes.dignus.com (8.9.1/8.6.9) id HAA04916; Wed, 30 Dec 1998 07:23:40 -0500 (EST) Date: Wed, 30 Dec 1998 07:23:40 -0500 (EST) From: Thomas David Rivers Message-Id: <199812301223.HAA04916@lakes.dignus.com> To: gjb@acm.org, henrich@flnet.com Subject: Re: Sed sillyness (stupid question?) Cc: freebsd-questions@FreeBSD.ORG In-Reply-To: <19981230105616.7077.qmail@alice.gba.oz.au> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > Why doesnt this work: > > > > sed 's,test,te\nst,' > > > > That is when test is found how come sed doesnt actually print the newline > > character? The man page claims it should: > > But you didn't do what the man page you quoted said: > > > A line can be split by substituting a newline character into it. > > To specify a newline character in the replacement string, precede > > it with a backslash. > > What you need is: > > sed 's,test,te\ > st,' > > In other words, you need a real backslash character followed by > a real newline character -- not some code for it like "\n". > > And, for the people who posted the wrong answers that I've seen > so far, please take the few seconds to check them first ... > You're right! For my response; sed complains about an unescaped new-line. [I only checked by using echo, didn't think sed would do any further checking...] Sorry to be partially correct... - Dave Rivers - To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message