Putting in newlines using sed
jpn at teddy.UUCP
jpn at teddy.UUCP
Wed Nov 20 06:15:40 AEST 1985
>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.
>
>... So then I tried using to do the following:
> s/foo/^Jfoo/g
I had no problem, in csh:
% sed 's/foo/\\
foo/g'
in sh:
$ sed 's/foo/\
> foo/g'
(don't type the prompts) The trick is that sed will accept a newline in
one of it's patterns if it is escaped with a backslash. The csh example
needs a second backslash to tell the shell that the command line is not
complete.
More information about the Comp.unix
mailing list