

uniq                         Command                         uniq




Remove/count repeated lines in a sorted file

uunniiqq [-ccdduu] [-_n] [+_n] [_i_n_f_i_l_e[_o_u_t_f_i_l_e]]

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 out-
file is omitted.  The following describes the available options:

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

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

-uu   Print only lines that are _n_o_t duplicated within the file.

uniq by default  behaves as if both -uu and  -d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 num-
     ber 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






















COHERENT Lexicon                                           Page 1


