Jan 022010
How to count the number of duplicated lines in a file
Answer:
Assume you have a file "test.txt"
a
b
b
c
c
c
You want to count the number of distinct rows, here is the command
# sort test.txt | uniq -c
1 a
2 b
3 c
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to count the number of duplicated lines in a file
Answer:
Assume you have a file "test.txt"
a
b
b
c
c
c
You want to count the number of distinct rows, here is the command
# sort test.txt | uniq -c
1 a
2 b
3 c