Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!linus!gatech!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.unix Subject: Re: Putting in newlines using sed Message-ID: <2269@umcp-cs.UUCP> Date: Wed, 20-Nov-85 02:34:18 EST Article-I.D.: umcp-cs.2269 Posted: Wed Nov 20 02:34:18 1985 Date-Received: Thu, 21-Nov-85 21:59:17 EST References: <376@bcsaic.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 25 Feeding `sed' newlines is easy; the real trick is getting the C shell to hand it the right stuff. The sed documentation says that in order to insert newlines in substitute commands, you should quote them with backslash: sed -e 's/foo/b\ a\ r/' Indeed, this works quite well in the Bourne shell, which does what I consider the `proper' thing with this input. The C shell, however, thinks it is smarter than you are, and *removes* the trailing backslashes! So instead you must type sed -e 's/foo/b\\ a\\ r/' Probably the best solution is to place your sed commands in a separate file; then which shell is used no longer matters. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu