uniq - Report or filter out repeated lines in a file
uniq [ options ] [infile [outfile]]
reads the input, compares adjacent lines, and writes one copy of each input line on the output. The second and
succeeding copies of the repeated adjacent lines are not written.
If the output file, outfile, is not specified, uniq writes to standard output. If no infile is given, or if
the infile is -, uniq reads from standard input with the start of the file defined as the current offset.
- -c, --count
Output the number of times each line occurred along with the line.
- -d, --repeated|duplicates
Output the first of each duplicate line.
- -D, --all-repeated[=delimit]
Output all duplicate lines as a group with an empty line delimiter
specified by delimit:
- Do not delimit duplicate groups.
Prepend an empty line before each group.
Separate each group with an empty line.
- The option value may be omitted. The default value is none.
- -f, --skip-fields=fields
fields is the number of fields to skip over before checking for
uniqueness. A field is the minimal string matching the BRE [[:blank:]]*[^[:blank:]]*. -number is equivalent to --skip-fields
- -i, --ignore-case
Ignore case in comparisons.
- -s, --skip-chars=chars
chars is the number of characters to skip over before checking for
uniqueness. If specified along with -f, the first chars after the first fields are ignored. If the chars
specifies more characters than are on the line, an empty string will be used for comparison. +number is equivalent to --skip-chars
- -u, --unique
Output unique lines.
- -w, --check-chars=chars
chars is the number of characters to compare after skipping any
specified fields and characters.
- The input file was successfully processed.
An error occurred.