Pega os 4 campos do IP e faz:
$ echo "obase=2;$CAMPO" | bc -l
sem mto tempo..
--
Flavio do Carmo Junior
On Dec 10, 2007 2:09 PM, Fábio Gomes <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
>
> Boa tarde lista,
>
> Alguem sabe alguma função que me retorne a rede em binario, eu
> informando ip e a mascara?
>
> Eu estou usando...
>
> IP_IF2=$(/sbin/ifconfig ${IF_LINK2} | awk '/inet addr:/ {print $2}' |
> cut -d: -f2)
> MASK_IF2=$(/sbin/ifconfig ${IF_LINK2} | awk '/inet addr:/ {print $4}' |
> cut -d: -f2)
> REDE2=$(ipmask $MASK_IF2 $IP_IF2 | cut -f2 -d" ")
>
> Mas preciso que seja em binario, preciso saber se eh /24, /18, etc...
>
> Obrigado
>
> Fábio Gomes dos Santos
>