Files
2024-02-19 00:21:39 -05:00

66 lines
1.1 KiB
Plaintext

Command: uniq - delete consecutive identical lines in a file
Syntax: uniq [-cdu] [-n] [+n] [input [output]]
Flags: -c Give count of identical lines in the input
-d Only duplicate lines are written to output
-u Only unique lines are written to output
-n Skip the first n columns when matching
+n Skip the first n fields when matching
Examples: uniq +2 file # Ignore first 2 fields when
comparing
uniq -d inf outf # Write duplicate lines to outf
Uniq examines a file for consecutive lines that are identical. All
but duplicate entries are deleted, and the file is written to output.
The +n option skips the first n fields, where a field is defined as a
run of characters separated by white space. The -n option skips the
first n spaces. Fields are skipped first.