[Ninux-Wireless] problem with big integer on openwrt

piuma a piumalab.org piuma a piumalab.org
Gio 15 Lug 2010 12:15:34 CEST


On 07/15/2010 12:01 PM, Gioacchino Mazzurco wrote:
> The problem is not Openwrt but awk that cannot handle big number on small
> device :(
>
> bash can than i fixed with this
>
> printf "%d\n" $(( (`echo "255.255.255.255" | awk -F\. '{printf "%d",
> ($4)}'`)+ (256*`echo "255.255.255.255" | awk -F\. '{printf "%d", ($3)}'`) +
> (256*256*`echo "255.255.255.255" | awk -F\. '{printf "%d", ($2)}'`) +
> (256*256*256*`echo "255.255.255.255" | awk -F\. '{printf "%d", ($4)}'`) ))
>

Also, Try this command:

echo "255.255.255.255" | awk -F\. '{printf 
$4"+"$3"*"256"+"$2"*256*256+"$1"*256*256*256\n"}' | bc

-- 
Il Piuma



Maggiori informazioni sulla lista Wireless