uniq
Program: uniq
Merges equal lines that follow each other.
Usage
uniq [OPTION]... [INPUT [OUTPUT]]
Description
Print the lines of INPUT, but equal lines that follow each other only once. Without INPUT, or with -, read the keyboard or pipe.
Options in the simulator
6 more options of the real program, not in the simulator yet
Examples
sort notes.txt Documents/notes.txt | uniq -c
2 Buy milk
1 Call the dentist
1 Water the plants uniq -c visitors.txt
1 10.0.0.5
1 10.0.0.9
2 10.0.0.5
1 10.0.0.7
1 10.0.0.9
1 10.0.0.5
1 10.0.0.9
sort visitors.txt | uniq -c
4 10.0.0.5
1 10.0.0.7
3 10.0.0.9 sort visitors.txt | uniq -c | sort -rn
3 anna
2 ben
1 carla Where you learn it
Lessons
- Chaining commands Terminal start
- Sort and count Linux Basics, Module 3: Text tools