[nycbug-talk] fun one liners

Charles Sprickman spork at bway.net
Thu Jun 8 17:30:54 EDT 2006


On Thu, 8 Jun 2006, Ray Lai wrote:

> Or:
>
> 	$ sort -t. -nk1,1 -k2,2 -k3,3 -k4,4 /tmp/random.ips

Oh, that is badass.

Combine with rancid and netmask and have a quick peek at what blocks might 
be available on a cisco router:

for ip in `clogin -c "sh ip route 216.x.x.0" x-router | awk '{print 
$2}' | grep "^[0-9]" | sort -t. -nk1,1 -k2,2 -k3,3 -k4,4 `; do netmask -r 
$ip; done

   216.x.x.0-216.x.x.31  (32)
  216.x.x.32-216.x.x.47  (16)
  216.x.x.48-216.x.x.63  (16)
  216.x.x.64-216.x.x.95  (32)
  216.x.x.96-216.x.x.103 (8)
216.x.x.104-216.x.x.111 (8)
216.x.x.112-216.x.x.127 (16)
216.x.x.128-216.x.x.135 (8)
216.x.x.136-216.x.x.143 (8)
216.x.x.144-216.x.x.159 (16)
216.x.x.160-216.x.x.175 (16)
216.x.x.176-216.x.x.183 (8)
216.x.x.184-216.x.x.191 (8)
216.x.x.192-216.x.x.223 (32)
216.x.x.224-216.x.x.255 (32)

Charles

> -Ray-
> _______________________________________________
> % NYC*BUG talk mailing list
> http://lists.nycbug.org/mailman/listinfo/talk
> %Be sure to check out our Jobs and NYCBUG-announce lists
> %We meet the first Wednesday of the month
>



More information about the talk mailing list