Re: [shell-script] Re: Regexp - IP

2008-09-02 Por tôpico Gmail
meus 5 cents a=$(ifconfig eth0) && a=${a##*"inet addr:"} && a=${a%%" Bcast"*};echo $a En/na Bruno Coimbra ha escrit: > > On Monday 01 September 2008 18:42:56 Alain M. wrote: > > então tenho um novo problema: > > > > na minha máquina: > > # ifconfig eth0 | grep "inet " > > inet end.: 10.0.0.33 Bc

Re: [shell-script] Re: Regexp - IP

2008-09-02 Por tôpico Bruno Coimbra
On Monday 01 September 2008 18:42:56 Alain M. wrote: > então tenho um novo problema: > > na minha máquina: > # ifconfig eth0 | grep "inet " >inet end.: 10.0.0.33 Bcast:10.0.0.255 Masc:255.255.255.0 > # ifconfig eth0 | grep "inet " | cut -d ':' -f2 > 10.0.0.33 Bcast > > No embedded

Re: [shell-script] Re: Regexp - IP

2008-09-01 Por tôpico Alain M.
Ok, mais uma vez: ifconfig eth0 | grep "inet " | sed 's/^[^:]*: *//g;s/ .*//g' já que é para usar sed, elimina o cut... Explicando o sed: tira tudo desde o começo que não seja ":", mais o próprio":" e possíveis " ", depois tira tudo do " " seguido de qq coisa o que eu acho *realmente* importan

Re: [shell-script] Re: Regexp - IP

2008-09-01 Por tôpico Alain M.
jimmy escreveu: >> Como que eu faço "grep -w inet" usando "grep -E" ??? > > se colocar algo como " inet " (delimitado por espaços) não resolve? Resolve, obrigado :) então tenho um novo problema: na minha máquina: # ifconfig eth0 | grep "inet " inet end.: 10.0.0.33 Bcast:10.0.0.255

Re: [shell-script] Re: Regexp - IP

2008-09-01 Por tôpico jimmy
___ On Mon, Sep 01, 2008 at 05:27:44PM -0300, Alain M. wrote: > > Gustavo escreveu: > > Acho que isso deve resolver: > > *getifaddr eth0* > > esse comando não é padrão, Nem tem no meu mandriva > > >> ifconfig eth0|grep

Re: [shell-script] Re: Regexp - IP

2008-09-01 Por tôpico Alain M.
Gustavo escreveu: > Acho que isso deve resolver: > *getifaddr eth0* esse comando não é padrão, Nem tem no meu mandriva >> ifconfig eth0|grep 'inet addr'|cut -d ':' -f2|cut -d ' ' -f1 1) Este comando tem problema com o portugues, por causa do "addr". 2) se usar "grep inet" no meu dá problema co

Re: [shell-script] Re: Regexp - IP

2008-08-31 Por tôpico Gustavo
Acho que isso deve resolver: *getifaddr eth0* 2008/8/30 erbots3 <[EMAIL PROTECTED]> > Douglas, mais uma: > > ifconfig eth0|grep 'inet addr'|cut -d ':' -f2|cut -d ' ' -f1 > > O principio é simples: > 1.- grep isola a linha onde se encontra o endereçi IP > 2.- o primeiro cut "limpa" o que está an