[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Regexp - IP
From: |
Cléoson Barreto |
Subject: |
Re: [shell-script] Regexp - IP |
Date: |
Fri, 29 Aug 2008 11:44:40 -0300 |
Olá!
Outra forma:
# ifconfig eth0 | egrep -o "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
| head -n1
192.168.0.128
[]'s
Cléoson.
2008/8/29 Cléoson Barreto <address@hidden>
> Olá,
>
> Vê se ajuda:
> # ifconfig eth0 | awk '/inet end.:/ { print $3 }'
> 192.168.0.128
>
> #ifconfig eth0 | grep inet | tr -s " " | cut -f4 -d" "
> 182.168.0.128
>
>
> []'s
> Cléoson.
>
>
> 2008/8/29 Douglas Milanez <address@hidden>
>
> Olá galera, tudo bom?
>>
>> Segunte: como fazer uma expressão regular que pegue a saida do comando
>> "ifconfig eth0" e retorne apenas o IP da máquina, ex.:
>>
>> # ifconfig | <regexp>
>> # 192.168.0.1
>>
>> --
>> []'s,
>> Douglas Milanez.
>>
>>
>
>
[As partes desta mensagem que não continham texto foram removidas]