uniq man page on OpenIndiana

Man page or keyword search:  
man Server   20441 pages
apropos Keyword Search (all sections)
Output format
OpenIndiana logo
[printable version]

uniq(1)				 User Commands			       uniq(1)

NAME
       uniq - report or filter out repeated lines in a file

SYNOPSIS
   /usr/bin/uniq
       /usr/bin/uniq [options] [infile [outfile]]

   ksh93
       uniq [options] [infile [outfile]]

DESCRIPTION
       uniq  reads an input, comparing adjacent lines, and writing one copy of
       each input line on the output. The second and succeeding copies of  the
       repeated adjacent lines are not written.

       If  the output file, outfile, is not specified, uniq writes to standard
       output. If no infile is given, or if the infile is -, uniq  reads  from
       standard	 input	with  the  start of the file is defined as the current
       offset.

OPTIONS
       -c			   Output  the	number	of  times  each	  line
       --count			   occurred along with the line.

       -d			   Output the first of each duplicate line.
       --repeated | duplicates

       -D			   Output  all duplicate lines as a group with
       --all-repeated[=delimit]	   an  empty  line  delimiter	specified   by
				   delimit:

				   none	       Do    not   delimit   duplicate
					       groups.

				   prepend     Prepend an  empty  line	before
					       each group.

				   separate    Separate	 each  group  with  an
					       empty line.

				   The	option	value  can  be	omitted.   The
				   default value is none.

       -f			   fields is the number of fields to skip over
       --skip-fields=fields	   before checking for uniqueness. A field  is
				   the	 minimal   string   matching  the  BRE
				   [[:blank:]]*[^[:blank:]]*.

       -i			   Ignore case in comparisons.
       --ignore-case

       -s			   chars is the number of characters  to  skip
       --skip-chars=chars	   over	 before	 checking  for	uniqueness. If
				   specified along with -f,  the  first	 chars
				   after  the  first  fields  are  ignored. If
				   chars specifies more characters than are on
				   the	line, an empty string is used for com‐
				   parison.

       -u			   Output unique lines.
       --unique

       -w			   chars is the number of characters  to  com‐
       --check-chars=chars	   pare	 after	skipping  any specified fields
				   and characters.

       -n			   Equivalent to -f fields with fields set  to
				   n.

       +m			   Equivalent to -s chars with chars set to m.

       --man			   Prints built-in manual page in either plain
       --html			   text, HTML or nroff format.
       --nroff

       --help			   Prints basic help information.

       --version		   Prints version information.

OPERANDS
       The following operands are supported:

       infile	      A path name of the input file. If infile is  not	speci‐
		      fied, or if the infile is −, the standard input is used.

       output_file    A path name of the output file. If outfile is not speci‐
		      fied, the standard  output  is  used.  The  results  are
		      unspecified  if  the  file  named by outfile is the file
		      named by infile.

EXAMPLES
       Example 1 Using the uniq Command

       The following example lists the contents of the uniq.test file and out‐
       puts a copy of the repeated lines.

	 example% cat uniq.test
	 This is a test.
	 This is a test.
	 TEST.
	 Computer.
	 TEST.
	 TEST.
	 Software.

	 example% uniq -d uniq.test
	 This is a test.
	 TEST.
	 example%

       The  next example outputs just those lines that are not repeated in the
       uniq.test file.

	 example% uniq -u uniq.test
	 TEST.
	 Computer.
	 Software.
	 example%

       The last example outputs a report with each line preceded by a count of
       the number of times each line occurred in the file:

	 example% uniq -c uniq.test
	    2 This is a test.
	    1 TEST.
	    1 Computer.
	    2 TEST.
	    1 Software.
	 example%

ENVIRONMENT VARIABLES
       See  environ(5) for descriptions of the following environment variables
       that affect the execution of uniq: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
       and NLSPATH.

EXIT STATUS
       The following exit values are returned:

       0     Successful completion.

       >0    An error occurred.

ATTRIBUTES
       See attributes(5) for descriptions of the following attributes:

       ┌─────────────────────────────┬─────────────────────────────┐
       │      ATTRIBUTE TYPE	     │	    ATTRIBUTE VALUE	   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Availability		     │SUNWcs			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │CSI			     │Enabled			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Interface Stability	     │Committed			   │
       ├─────────────────────────────┼─────────────────────────────┤
       │Standard		     │See standards(5).		   │
       └─────────────────────────────┴─────────────────────────────┘

SEE ALSO
       comm(1),	   ksh93(1),   pack(1),	  pcat(1),   sort(1),	uncompress(1),
       attributes(5), environ(5), standards(5)

SunOS 5.11			  29 Nov 2009			       uniq(1)
[top]

List of man pages available for OpenIndiana

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net