Re: sed task

From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 02/29/04


Date: Sun, 29 Feb 2004 06:05:05 GMT

On Sun, 29 Feb 2004 00:03:33 -0500, Nick <nbdy9.nospam@hotmail.com> wrote:
>
>
> How to use sed do the following task:
>
> suppose I have a html file. I want to replace all the "-" with "_" in
> all the <title> tags?
>
> from
><... tag="abd-123-345" title="abd-123-345" ....>
> to
><... tag="abd-123-345" title="abd_123_345" ....>

You could try this:

sed 's/\(title=".*\)-\(.*\)-\(.*"\)/\1_\2_\3/' inputfile > outputfile

AC

-- 
ed(1) Check out the original tutorials by Brian W.
Kernighan at the Ed Home Page  http://tinyurl.com/2aa6g