Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!caip!brl-adm!brl-smoke!smoke!kvamme%vax.runit.unit.uninett@NTA-VAX.arpa From: kvamme%vax.runit.unit.uninett@NTA-VAX.arpa (P}l Kvamme) Newsgroups: net.unix Subject: Help with sed Syntax Message-ID: <4811@brl-smoke.ARPA> Date: Wed, 22-Oct-86 08:38:21 EDT Article-I.D.: brl-smok.4811 Posted: Wed Oct 22 08:38:21 1986 Date-Received: Wed, 22-Oct-86 23:14:52 EDT Sender: news@brl-smoke.ARPA Lines: 24 > I'm have been trying (unsuccessfully) to determine what the correct syntax > would be for sed to substitute a given expression with multiple newlines. > .... > For example,I would like to do something like the following: > > s/^ 0/\ > / > >where the backslash is to escape a newline character. Try this: /^ 0/i\ # insert text before all occurences of ^ 0 # text to insert - a blank line s/^ 0// # get rid of the ^ 0 on the start of the line Of course, it only works when the expression to substitute is at column 1. Beware of quoting shell metacharacters. It might be best to place the commands on a file, and use sed -f cmds. P}l Kvamme Computer science student NIT, Trondheim, Norway ARPA: kvamme@vax.runit.unit.uninett@tor.arpa VOICE: + 47 7 593674