From: joeyh Date: Wed, 26 Jul 2006 02:40:28 +0000 (+0000) Subject: * combine: Man page improvements, to clarify even more that order does X-Git-Tag: 0.15~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11a51513fff47e8756ecdc1f24703b540c309eb5;p=moreutils * 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". --- diff --git a/combine b/combine index 6ab3b43..97311dd 100755 --- a/combine +++ b/combine @@ -31,7 +31,7 @@ operation specified, the contents will be combined in different ways: =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 @@ -50,7 +50,10 @@ Outputs lines that are in either file1 or file2, but not in both files. "-" 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/[ @@ -91,9 +94,8 @@ sub hashify { 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 { diff --git a/debian/changelog b/debian/changelog index 679d7cd..db55dc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,8 +7,14 @@ moreutils (0.15) UNRELEASED; urgency=low instead of trying to rename the file to "". * vidir: Remove the periods after the item numbers. * vidir: Man page improvements. Closes: #378122 - - -- Joey Hess 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 Tue, 25 Jul 2006 22:26:56 -0400 moreutils (0.14) unstable; urgency=low