SYNOPSIS
uniq
[
uniq
[
DESCRIPTION
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.
Options
-c -
precedes each output line with the number of times that line occurred in the input.
-d -
displays only lines which are repeated (one copy of each line).
-f number1-
ignores the first number1 fields when comparing lines. Blanks separate fields in the input.
-s number2-
ignores the first number2 characters when comparing lines. If you specify both
-s and-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
EXAMPLES
uniq
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.
uniq -d
outputs one instance of each repeated line in the input (and omits all unique lines).
DIAGNOSTICS
Possible exit status values are:
- Missing character skip count
-
You specified
-s but did not supply a number after the-s . - Missing number of fields to skip
-
You specified
-f but did not supply a number after the-f . - field skip not a number in "string"
-
In a
- number or+ number construct, number wasn't valid. This could arise from a typo when entering a- option.
PORTABILITY
POSIX.2. x/OPEN Portability Guide 4.0. All UNIX systems. Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.
AVAILABILITY
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
SEE ALSO
PTC MKS Toolkit 10.4 Documentation Build 39.