Linux How to..

Linux How to ,Share Knowledge

TAG : Command line Check Duplicate Number on file

Example : if you need to check dulicate number on filename test.txt and send output to filename duplicate-test.txt

cat test.txt

1111
2222
3333
4444
5555
1111
1111
2222

cat test.txt | rev | cut -f1 -d/ | rev | sort | uniq -c | expand | grep -v ‘ 1 ‘ > duplicate-test.txt

cat duplicate-test.txt

3 1111
2 2222
#Meaning line above

3 1111 –> 1111 Duplicate 3 line
2 2222 –> 2222 Duplicate 2 line
Success!!!!

Comments are closed.