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:42:25 -0300

2006/10/2, Sergio Nery Simoes <address@hidden>:

   A forma usando dois cuts é assim:

 ping -c 1 www.google.com 2> /dev/null | head -n 1 | cut -d"(" -f2 | cut
 -d")" -f1

 Sergio.



 Em 02/10/06, Herbert Alexander Faleiros <address@hidden> escreveu:
 >
 > On Monday 02 October 2006 17:57, Celso Viana wrote:
 > > como é que pega somente o que está
 > > dentro dos parenteses (endereço IP)?
 >
 > sed -r 's/.+\((.+)\).+/\1/g'
 >
 >
 >


 [As partes desta mensagem que não continham texto foram removidas]



Sergio,

Veja o resultado da execução...

%ping -c 1 www.google.com 2> /dev/null | head -n 1 | cut -d"(" -f2 |
cut -d")" -f1
Ambiguous output redirect.

Se o retorno de "ping -c 1 www.google.com" foi redirecionado para o
buraco negro, o head ainda vai pegar alguma coisa?

--
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]