blm - manipulate line oriented files using boolean set operations and,
or, exclusive or, and set difference.
blm firstfile [+afile] [-bfile] [%cfile] [\&dfile] [@]...
blm reads in one or more line-oriented files and considers each file as
a set of strings. Blank lines do not represent the empty string, but
instead are ignored. The first command line argument shown as
firstfile above represents the starting set of lines. The arguments
are then interpretted according to Forward Polish Notation (FPN), as
described by Jan Lukasiewicz. Jan invented the first widely accepted
non-classical logic as well as this excellent notation. FPN requires no
parentheses to describe arbitrarily complex combinations of any number
of binary operations.
Each successive command line argument after the first represents an
operation that starts with the accumulator set A, applies the set
operation A op B, and then stores the result in the accumulator A.
Another set operation may then be performed until all listed arguments
are used up. The result is then printed in lexicographical order to
standard output. Four operations are supported: Set union is the plus
symbol (+). Set intersection is the and symbol ( & ) which must be
escaped in most shells. Set difference is the subtraction symbol (-).
And set exclusive or is represented by the percent sign (%). There is
also an optional shuffling symbol toggle, (@), that means to randomly
shuffle all output lines instead of sorting in lexicographical order.
Thus, a simple way to randomize lines in a file is as follows:
blm firstfile @
If a filename of "-" is listed, it represents the standard input to
If none of the four option characters appears at the beginning
of a filename argument, set addition (+) is assumed.
No environment variables.
Please report bugs to the Debian BTS.
Rudi Cilibrasi <email@example.com>