=item and
-Outputs lines that are common to both files.
+Outputs lines that are in file1 if they are also present in file2.
=item not
"-" can be specified for either file to read stdin for that file.
The input files need not be sorted, and the lines are output in the order
-they accur in file1 (or file2 for the two "or" operations).
+they occur in file1 (followed by the order they occur in file2 for the two
+"or" operations). Bear in mind that this means that the operations are not
+commutative; "a and b" will not necessarily be the same as "b and a". To
+obtain communtative behavior sort and uniq the result.
Note that this program can be installed as "_" to allow for the syntactic
sugar shown in the latter half of the synopsis (similar to the test/[
sub compare_or {
my ($file1, $file2) = @_;
- my $seen;
- filemap $file1, sub { print "$_\n"; $seen->{$_}++ };
- filemap $file2, sub { print "$_\n" unless $seen->{$_} };
+ filemap $file1, sub { print "$_\n" };
+ filemap $file2, sub { print "$_\n" };
}
sub compare_xor {
instead of trying to rename the file to "".
* vidir: Remove the periods after the item numbers.
* vidir: Man page improvements. Closes: #378122
-
- -- Joey Hess <joeyh@debian.org> Thu, 13 Jul 2006 16:58:20 -0400
+ * combine: Man page improvements, to clarify even more that order does
+ matter and that the operations are not commutative. Closes: #361123
+ * combine: The behavior of "or" was fairly strange if lines were repeated in
+ a file. Changed behavior to just print all lines from both files, even
+ if this means printing dups. Not sure I like this behavior either, but
+ it's consistent with the very useful behaviors of "and" and "not".
+
+ -- Joey Hess <joeyh@debian.org> Tue, 25 Jul 2006 22:26:56 -0400
moreutils (0.14) unstable; urgency=low