Putting in newlines using sed

preece at ccvaxa.UUCP preece at ccvaxa.UUCP
Tue Nov 19 03:07:00 AEST 1985


> This is on BSD 4.2...  I have a process putting out lines that look
> something like this:
>	fjlkjf foo (a b c) jflkjf (jfkj)  foo (x y a) fjjfj
> I want to break up the line so that each "foo" followed by its
> parenthesized list of arguments appears on a separate line.  I don't
> care what happens to the other "words;" they are eliminated in later
> processing.  /* Written 12:29 pm  Nov 15, 1985 by michaelm at bcsaic.UUCP
> in ccvaxa:net.unix */
----------
You're just not quoting enough.  The cshell is grabbing your
quote character.  The command 
	sed 's/foo/\\^Jfoo/g' filename
where '^J' is the actual control-J character, and filename is
the name of your file (piping in will work fine).

You could also put the command in a file, with just one backslash.

-- 
scott preece
gould/csd - urbana
ihnp4!uiucdcs!ccvaxa!preece



More information about the Comp.unix mailing list