| www.delorie.com/gnu/docs/textutils/coreutils_29.html | search |
![]() Buy GNU books! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
uniq: Uniquify files
uniq writes the unique lines in the given `input', or
standard input if nothing is given or for an input name of
`-'. Synopsis:
uniq [option]... [input [output]] |
By default, uniq prints the unique lines in a sorted file, i.e.,
discards all but one of identical successive lines. Optionally, it can
instead show only lines that appear exactly once, or lines that appear
more than once.
The input need not be sorted, but duplicate input lines are detected
only if they are adjacent. If you want to discard non-adjacent
duplicate lines, perhaps you want to use sort -u.
If no output file is specified, uniq writes to standard
output.
The program accepts the following options. Also see 2. Common options.
On older systems, uniq supports an obsolete option
`-n'. POSIX 1003.1-2001 (see section 2.5 Standards conformance)
does not allow this; use `-f n' instead.
On older systems, uniq supports an obsolete option
`+n'. POSIX 1003.1-2001 (see section 2.5 Standards conformance)
does not allow this; use `-s n' instead.
Note that when groups are delimited and the input stream contains two or more consecutive blank lines, then the output is ambiguous. To avoid that, filter the input through `tr -s '\n'' to replace each sequence of consecutive newlines with a single newline.
This is a GNU extension.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |