COHERENT manpages

This page displays the COHERENT manpage for uniq [Remove/count repeated lines in a sorted file].

List of available manpages
Index


uniq -- Command

Remove/count repeated lines in a sorted file
uniq [-cdu] [-n] [+n] [infile[outfile]]

uniq reads  input line  by line from  infile and writes  all non-duplicated
lines to  outfile. The input file  must be sorted.  uniq  uses the standard
input  or output  if either  infile or outfile  is omitted.   The following
describes the available options:

-c   Print each  line once, discarding  duplicate lines; before  each line,
     print the number of times it appears within the file.

-d   Print only lines that are  duplicated within the file; print each line
     only once; do not print any counts.

-u   Print only lines that are not duplicated within the file.

uniq by default  behaves as if both -u and  -d were specified, so it prints
each unique line once.

Optional specifiers allow uniq to  skip leading portions of the input lines
when comparing for uniqueness.

-n   Skip n fields of each input  line, where a field is any number of non-
     white  space  characters  surrounded  by  any  number of  white  space
     characters (blank or tab).

+n   Skip n characters in each input line, after skipping fields as above.

See Also

comm,
commands,
sort