This page explains the syntax and lists the options to the uniq command and how to use them.

Code Output

         *Note: These are the file that are compared to each other to illustrate the uniq command.

Output

-u option

         This tells the command to only print lines that are not repeated in the input.

Output

-d option

         Print only lines that have been repeated in the input.

Output

-c option

         This tells the command to report the repeated lines as it normally would but put a count of how many times the line repeated directly after the line. When this command is used the -u and -d options are both ignored by the command.

Output

-i option

         This tells the command to ignore the case differences when it is comparing lines.

Output

-f option

         This tells the command to the number of fields (define fields) in a line.

Output

-s option

         Tells the command to skip a user specified number of characters in the line.

Output

-w option

         This option specifies the number of characters to compare in each line (user defines how many characters to look at), after the specified number of characters has been compared by the command the remaining characters are ignored.

Output