[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Expresão regular para filtar URL



On 7/17/07, Herbert P Fortes Neto <h_p_f_n@yahoo.com.br> wrote:

> > URL
> > http://www.itau.com.br/campanhas/bankline/lancamento/detecta_482x192.htm
> > https://itaubankline.itau.com.br:443
> >
> > Resultado: SITE
> > http://www.itau.com.br
> > https://itaubankline.itau.com.br
> >
> > Fiz a seguinte expressão regular para usar com o sed:
> > sed 's/\w\+:\/\/\(\w\+-\?\w*\.\)\+\w*//' arquivo_com_urls

 Olá

 O sed pode ficar mais simples.

$ sed s'/br\(.*\)/br/'

Não se o site não tiver .br como www.google.com, por exemplo:

max-vmsuse:~ # echo http://www.google.com/teste | sed s'/br\(.*\)/br/'
http://www.google.com/teste



--
Por favor não faça top-posting, coloque a sua resposta abaixo desta linha.
Please don't do top-posting, put your reply below the following line.
--------------------------------------------------------



Reply to: