Sunday, May 3, 2009

Get the network ID from an IP address and subnet mask


echo "192.168.5.133 255.255.255.250" | \
awk 'BEGIN {FS="[. ]"; OFS="."} {print and($1,$5), and($2,$6), and($3,$5), and($4,$8)}'

192.168.5.128

No comments:

Post a Comment