Putting in newlines using sed

Jerry Peek jerryp at tektools.UUCP
Tue Nov 19 02:22:08 AEST 1985


In article <376 at bcsaic.UUCP> michaelm at bcsaic.UUCP (michael b maxwell) writes:
> 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.

In Bourne shell:

	sed 's/foo/\
	foo/g'

In C-shell, you'll need a second backslash:

	sed 's/foo/\\
	foo/g'

--Jerry Peek, UNIX Training Instructor, Tektronix, Inc.
US Mail:    MS 74-222, P.O. Box 500, Beaverton, OR 97077
uucp:       {allegra,decvax,hplabs,ihnp4,ucbvax}!tektronix!tektools!jerryp
CS,ARPAnet: jerryp%tektools at tektronix.csnet
Phone:      503/627-1603



More information about the Comp.unix mailing list