TUNIQ v2.10 - print lines that evaluate uniquely
Documentation revised 21 Oct 00 - Copyright (c) 1996-2000 by Rune Berg. TextTools Freeware.

Contents:


Usage Top || Next

tuniq [log logfile] [options] [from infile] [to outfile] expression [...]

See Understanding The Usage Section for details.


Description Top || Previous || Next

tuniq prints, to outfile, the lines in infile that evaluate uniquely on the given expression(s).

Expressions are as for tcols.

infile must be an ASCII text file. tuniq sees each input line as a row of (by default) whitespace-separated fields; see tcols for more info.

tuniq ignores empty (whitespace only) input lines.

The output lines are identical to the input lines, and in the original order.

tuniq compares expression results according to the following rules:

If you don't specify infile, tuniq reads from standard input.
If you don't specify outfile, tuniq writes to standard output.
If you don't specify logfile, tuniq writes error messages to standard error.


Examples Top || Previous || Next

Consider the file "records.txt":

      Band             "The Band"            1969 LP
      "Violent Femmes" "Violent Femmes"      1983 LP
      "Violent Femmes" "Violent Femmes"      1983 CD
      Beatles          Revolver              1966 CD
      Beatles          "Rubber Soul"         1965 CD
      "Waits, Tom"     Swordfishtrombones    1983 CD
      Band             "Music From Big Pink" 1968 LP
      "Waits, Tom"     Swordfishtrombones    1983 LP

Ex. 1 (global uniqueness, default): The command:

      tuniq from records.txt $1 $2 $3

prints the record list without CD/LP duplicates:

      Band             "The Band"            1969 LP
      "Violent Femmes" "Violent Femmes"      1983 LP
      Beatles          Revolver              1966 CD
      Beatles          "Rubber Soul"         1965 CD
      "Waits, Tom"     Swordfishtrombones    1983 CD
      Band             "Music From Big Pink" 1968 LP

Ex. 2 (global non-uniqueness): The command:

      tuniq -d from records.txt $1 $2 $3

prints the CD/LP duplicates:

      "Violent Femmes" "Violent Femmes"      1983 LP
      "Violent Femmes" "Violent Femmes"      1983 CD
      "Waits, Tom"     Swordfishtrombones    1983 CD
      "Waits, Tom"     Swordfishtrombones    1983 LP

Ex. 3 (local uniqueness): The command:

      tuniq -l from records.txt $1 $2 $3

prints:

      Band             "The Band"            1969 LP
      "Violent Femmes" "Violent Femmes"      1983 LP
      Beatles          Revolver              1966 CD
      Beatles          "Rubber Soul"         1965 CD
      "Waits, Tom"     Swordfishtrombones    1983 CD
      Band             "Music From Big Pink" 1968 LP
      "Waits, Tom"     Swordfishtrombones    1983 LP

Ex. 4 (local non-uniqueness): The command:

      tuniq -l -d from records.txt $1 $2 $3

prints:

      "Violent Femmes" "Violent Femmes"      1983 LP
      "Violent Femmes" "Violent Femmes"      1983 CD


Options Top || Previous || Next

tuniq recognizes the following command line options:


Limitations Top || Previous || Next

tuniq has the same limitations as tcols.

tuniq runs out of memory when infile, or the expressions evaluated thereof, are too large.


Return Codes Top || Previous || Next

tuniq returns with one of the following codes ("error levels"):

For more details, see TextTools General Features.


Version History Top || Previous

These are the released versions of tuniq:

End of document