r/linuxadmin • u/setner • Jul 27 '15
moreutils: the utilities package every UNIX/Linux/Mac OS developer should know
http://rentes.github.io/unix/utilities/2015/07/27/moreutils-package/
64
Upvotes
View all comments
Show parent comment
2
u/primitive_screwhead Jul 28 '15
The commutability behavior, which is an explicitly documented feature of "combine", is wrong for both your 'xor' and 'and' replacements.
Your 'combine file1 and file2' replacement:
Your 'combine file1 xor file2' replacement:
A (possibly?) correct 'xor' is (note re-ordering of the file args):
The proper 'and' would be:
Well, I'd say less frequently than I 'and' or 'not' two files, but certainly I'd want to do it correctly. Chained greps (imo), and even simple greps can get tricky because it's less clear when the ordering of operations or arguments is mistakenly reversed. So, there is value in having a nice shortcut shell function name that clearly shows intent; "combine" is basically that (except implemented in Perl, not shell).