delete matching in multiple lines sed
Nils Kassube
kassube at gmx.net
Sat Jul 25 22:33:37 UTC 2009
Soren Orel wrote:
> whops, wrong example, this one's the good:
> echo -e "something\n</tr>\n<tr>\n</tr>\nsomething" | sed
> "s/<\/tr>\n<tr>\n<\/tr>/<\/tr>/g"
> And this is not working :D
> $ echo -e "something\n</tr>\n<tr>\n</tr>\nsomething" | sed
> "s/<\/tr>\n<tr>\n<\/tr>/<\/tr>/g"
> something
> </tr>
> <tr>
> </tr>
> something
>
>
> I just want to swap the:
> </tr>
> <tr>
> </tr>
> to this:
> </tr>
You mean something like this?
echo -e "foo\nbar\n</tr>\n<tr>\n</tr>\nblah" |
sed -e N -e N -e "s#</tr>\n<tr>\n</tr>#</tr>#g" -e P -e D
Nils
More information about the ubuntu-users
mailing list