uniq manipulates lines which occur more than once in a file. The file must be sorted, since uniq only compares adjacent lines. When you invoke this command with no options, it writes only one copy of each line in input_file to output_file. If you do not specify input_file or you specify -, uniq reads the standard input. If you do not specify output_file, uniq uses the standard output.
precedes each output line with the number of times that line occurred in the input.
displays only lines which are repeated (one copy of each line).
ignores the first number1 fields when comparing lines. Blanks separate fields in the input.
ignores the first number2 characters when comparing lines. If you specify both
-sand -f, uniq ignores the first number2 characters after the first number1 fields. -u
displays only those lines which are not repeated.
You may choose only one of the
is a filter which prints one copy of each different line in its sorted input.
uniq -f 2 -s 1
compares lines starting with the 2nd character of the 3rd field.
outputs one instance of each repeated line in the input (and omits all unique lines).
Possible exit status values are:
Failure due to any of the following:
- Missing character skip count
-sbut did not supply a number after the -s.
- Missing number of fields to skip
-fbut did not supply a number after the -f.
- field skip not a number in "string"
-number or +number construct, number wasn't valid. This could arise from a typo when entering a -option.
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows Server 2012. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019.
PTC MKS Toolkit for Power Users
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
PTC MKS Toolkit 10.3 Documentation Build 39.