Thursday, March 17, 2011

Linux Trick

To sort a list of ip address

sort -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 <list

To delete duplicates, pipe the outout through uniq

sort -n -t '.' -k 1,1 -k 2,2 -k 3,3 -k 4,4 <list|uniq

No comments:

Post a Comment

Off topic comments will be deleted. Comments with spelling or grammar errors may be deleted unless they have hoplophobic or statist content in which case they will be highlighted and ridiculed.