logo       

sed pattern recognition with consecutive lines: msg#00070

editors.sed.user

Subject: sed pattern recognition with consecutive lines

I have been playing with this all morning and have not found the
solution so hopefully someone has a suggestion. What I am trying to
do is have sed recognize a pattern of words falling on consecutive
lines, for example if I had an example file structured as:

I
have
been
there
and
I
do
not
like
it

and I would like to make the file look like this:

I
have
been
there
and
We
can
like
it

My thought was something like:

sed 's/I\ndo\nnot/We\ncan/' example.file

but this does not work. I can make the newline (\n) work in the
replacement part, but it does not seem to work in the pattern
recognition part.

Any ideas?






------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/dkFolB/TM
--------------------------------------------------------------------~->

--

Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/sed-users/

<*> To unsubscribe from this group, send an email to:
sed-users-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise