uniq
uniq linux command cheatsheet by Thamizhiniyan C S
Introduction
Unique command filters the output (from either a file or stdin) to remove any duplicates.
Syntax
uniq [OPTION]... [INPUT [OUTPUT]]
Important Flags
Flags | Description |
---|---|
| To count the occurrences of every line in file or stdin |
| Will only print the lines that are repeated, not the one which are unique |
| Will only print lines that are already uniq |
| Ignores case(Default is case-sensitive) |
Examples
Command | Description |
---|---|
Remove the consecutive repetitions of any line | |
Count the occurrences of consecutive identical lines in the input, then cut out the first six characters (presumably to remove the counts added by | |
Count the occurrences of consecutive identical lines while ignoring case differences and then remove the count information, leaving only the original content of the lines | |
Print only the lines that occur exactly once in the input, discarding any duplicate lines. |
Last updated