May 31, 1994; Gregg M. Townsend
This file is in the public domain.
Setmerge combines sets of items according to the specified operators.
Sets are read from files, one entry per line. Operation is from left
to right without any precedence rules. After all operations are
complete the resulting set is sorted and written to standard output.
Usage: setmerge file [[op] file]...
Operations:
+ add contents to set
- subtract contents from set
* intersect contents with set
Note that operators must be separate command options, and that some
shells my require some of them to be quoted.
Example 1: combine files, sorting and eliminating duplicates:
setmerge file1 + file2 + file3 + file4
Example 2: print lines common to three files
setmerge file1 '*' file2 '*' file3
Example 3: print lines in file1 or file2 but not in file3
setmerge file1 + file2 - file3
Source code |
Program Library Page |
Icon Home Page