How to count the number of duplicated lines in a file
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
Related posts:
- How to remove duplicated lines in a file
- Count the number of matching lines from grep
- Find duplicated records in MySQL
- Join lines on a common field
- Remove empty lines in a file
Post a Comment