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:
Option | Function |
---|---|
-iC | Separate fields in infile by character C (except \). Use \t to form a tab. |
-csvi | Do CSV (comma separated values) style parsing of input fields from infile. Unless the -iC option is given, use a comma as the field separator. |
-d | Print the lines that do not evaluate uniquely on the given expressions. The lines printed are sorted on the expression results, and in the original order where such results are equal. |
-l | Determine uniqueness with respect to only (the expression results of) the previous line (the default being to determine uniqueness with respect to (the expression results of) all previous lines). When combined with the -d option, determine non-uniqueness in ditto manner. As a side-effect, using the -l option greatly reduces the amount of memory used by tuniq, since tuniq no longer needs to store all input line and their expression results. |
-fppN | Use floating-point precision N (0..15, default 6) decimal digits for comparisons/output. See separate discussion on floating point numbers for more details. |
-r | Print a one-line report to standard error (or logfile, if given) after processing. This option has no effect if processing is aborted due to an error. |
-v | Print version banner and usage info to standard error (or logfile, if given), then exit. |
-he | Print summary of expression usage to standard error (or logfile, if given), then exit. |
-hfc | Print summary of character functions to standard error (or logfile, if given), then exit. |
-hfs | Print summary of string functions to standard error (or logfile, if given), then exit. |
-hfp | Print summary of pattern functions to standard error (or logfile, if given), then exit. |
-hfv | Print summary of conversion functions to standard error (or logfile, if given), then exit. |
-hfm | Print summary of maths functions to standard error (or logfile, if given), then exit. |
-hfx | Print summary of miscellanous functions to standard error (or logfile, if given), then exit. |
-hf name | Print summary of named function to standard error (or logfile, if given), then exit. |
-hp | Print summary of pattern usage to standard error (or logfile, if given), then exit. |
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"):
Code | Meaning |
---|---|
0 | Success |
101 | Out of memory |
102 | Incorrect/missing command line arguments |
104 | Error opening file |
105 | I/O Error |
106 | Capacity overrun |
107 | File name clash |
109 | Bad input data |
For more details, see TextTools General Features.
Version History | Top || Previous |
These are the released versions of tuniq:
Version | Date | Changes |
---|---|---|
1.30 | 24-Sep-96 | n/a |
1.40 | 23-Feb-97 |
|
1.50 | 12-Jul-97 |
|
2.00 | 2-Jan-99 |
|
2.10 | 21-Oct-00 |
|
End of document |