Wednesday, 14 January 2009

sort and uniq combined using awk

Say, I have the following IP addresses file ip.txt :

cat > ip.txt

How to see the unique no. of ips in the above file ?

way 1: sort ip.txt | uniq

way 2 using awk : cat ip.txt | awk '!x[$0]++'

No comments:

Post a Comment

Tweets by @sriramperumalla