[Gllug] hex IP addresses in /proc

will will at willj.net
Thu Mar 2 11:33:36 UTC 2006


will wrote:
> cat /proc/net/ip_mr_cache | ruby -ne '$. == 1 and next; puts 
> $_[0..16].split.collect{|x| a = []; 4.downto(1) {|i| a << "%d" % x[i*2-2 
> .. i*2-1].to_i(16) }; a.join(".") }.join(" ")'

Ooops, didn't need the '"%d" % ':

cat /tmp/test | ruby -ne '$. == 1 and next; puts 
$_[0..16].split.collect{|x| a = []; 4.downto(1) {|i| a << x[i*2-2 .. 
i*2-1].to_i(16) }; a.join(".") }.join(" ")'
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list