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

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

Re: Regexp - IP


From: erbots3
Subject: Re: Regexp - IP
Date: Tue, 02 Sep 2008 01:15:54 -0000
User-agent: eGroups-EW/0.82

Alain,

Você pode tentar algo como:
ifconfig eth0 | grep "inet " | cut -d ':' -f2|sed 's/ //g;s/[A-Za-z]//g;'

O comando sed ao final simplesmente limpa qualquer espaco e qualquer
combinação de letras que ficar após o grep e o cut.

Abraços,
Eduardo.

--- Em address@hidden, "Alain M." <alainm@...> escreveu
>
> 
> 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  Masc:255.255.255.0
> # ifconfig eth0 | grep "inet " | cut -d ':' -f2
>   10.0.0.33  Bcast
> 
> No embedded com busybox
> # ifconfig eth0 | grep "inet "
>            inet end.:10.0.0.33  Bcast:10.255.255.255  Masc:255.0.0.0
> # ifconfig eth0 | grep "inet " | cut -d ':' -f2
> 10.0.0.33  Bcast
> 
> observem que em um caso existe um " " antes do ip e no outro não...
> 
> Alguma sugestão que funciona nos dois?
> 
> Alain
>




reply via email to

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