Freedom to Write
Wednesday 14 January 2009
sort and uniq combined using awk
Say, I have the following IP addresses file ip.txt :
cat > ip.txt
1.2.3.4
4.5.6.7
1.2.3.4
8.9.0.1
4.5.6.7
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
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Tweets by @sriramperumalla
No comments:
Post a Comment