shell-script-pt
[Top][All Lists]
Advanced

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

Re: [shell-script] selecionar substring


From: Celso Viana
Subject: Re: [shell-script] selecionar substring
Date: Mon, 2 Oct 2006 18:37:12 -0300

2006/10/2, Humberto Pereira <address@hidden>:

   On Mon, 02 Oct 2006 17:57:49 -0300, Celso Viana <address@hidden>
 wrote:
 > Na linha abaixo, como é que pega somente o que está dentro dos
 > parenteses (endereço IP)?
 >
 > PING teste.com (69.36.226.134): 56 data bytes
 Opa,

 [begnini@coke analise]$ echo "PING teste.com (69.36.226.134): 56 data
 bytes" | sed -r 's/^.*\((([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/'
 69.36.226.134
 [begnini@coke analise]$

 []s
 Humberto Pereira
 --
 Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Humberto,

Poderia traduzir o ...
sed -r 's/^.*\((([0-9]{1,3}\.){3}[0-9]{1,3}).*$/\1/'

o que faz a opção "-r" (sh/csh no FreeBSD não tenho essa oção)

Valews

--
Celso Vianna
BSD User: 51318
http://www.bsdcounter.org

63 8404-8559
Palmas/TO


reply via email to

[Prev in Thread] Current Thread [Next in Thread]