diff options
author | joeyh <joeyh> | 2006-07-26 02:40:28 +0000 |
---|---|---|
committer | joeyh <joeyh> | 2006-07-26 02:40:28 +0000 |
commit | 11a51513fff47e8756ecdc1f24703b540c309eb5 (patch) | |
tree | faa20d0cc8fc8e581871f452e87a1c570fd29f0f /combine | |
parent | 3095ba17495d0f1871900fcc1c87e6efe9f55f18 (diff) | |
download | moreutils-11a51513fff47e8756ecdc1f24703b540c309eb5.tar.gz |
* 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".
Diffstat (limited to 'combine')
-rwxr-xr-x | combine | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 { |