Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!brl-adm!adm!quilico@cecom-2.arpa From: quilico@cecom-2.arpa (Grace Quilico) Newsgroups: comp.unix.questions Subject: Re: Help with sed Syntax Message-ID: <1106@brl-adm.ARPA> Date: Mon, 24-Nov-86 16:21:16 EST Article-I.D.: brl-adm.1106 Posted: Mon Nov 24 16:21:16 1986 Date-Received: Tue, 25-Nov-86 21:14:49 EST Sender: news@brl-adm.ARPA Lines: 39 Thanks to everyone who responded to my plea for help with the correct syntax to use for sed in order to interpret carriage-control characters. Many who responded asked if I was typing the commands directly into the shell - I was using a file containing the sed commands (e.g., as in sed -f sed.cmds testfile > sed.out). Another problem I was having was that I was not processing the lines beginning with a space in column 1 first - this caused problems (e.g., change the line beginning with a zero in column 1; now it begins with a space; now process that same line (incorrectly) as if the space were being used for carriage control). Anyway! My shell script looked like this: cat > sed.cmds <, not ^L) /^ /{ A space in col. 1, used for space (remove it) s/ // } /^0/{ A zero in col. 1, used for double-spacing s/0// i\\ The following line inserts a newline character } /^-/{ A dash in column 1, used for triple-spacing s/-// i\\ The following lines insert 2 newline characters } EOF sed -f sed.cmds testfile > sed.out rm -f sed.cmds Again, thanks to all who responded! Grace Quilico Technical Liaison AV 995-2275 Comm: (201) 544-2275