Re: [Hampshire] extracting phrases from a file.

Page principale

Répondre à ce message
Auteur: Bob Dunlop
Date:  
À: hampshire
Sujet: Re: [Hampshire] extracting phrases from a file.
On Mon, Sep 12 at 10:17, James Courtier-Dutton wrote:
> Hi.
>
> I have a large file that contains snips of http pages.
> Each line is like this:
> ....some junk.....<a href="some url"></a>
>
> I want extract the "some url" bits. I.e. Remove the href.
> You can probably do this quite easily in perl.
> Are there any nice short programs to do this?
> Is it easier to do in some other language?


How about:

    sed -n -e 's/.*href="\([^"]*\).*/\1/p' file


-- 
        Bob Dunlop