Padraig Brady wrote:
> Breathnach, Proinnsias (Dublin) wrote:
>>>>> to find all unique lines from both files:
>>>>>>>> sort [ab].txt | uniq -u
>>>>>>>>>> b.txt is a subset of a.txt in this case
>>> so your first eg is all that's required.
>>>>>> Padraig.
>>>>>>> Surely a sort -u [ab].txt
>> would suffice ... and save a pipe ?
>>> First of all sort shouldn't have -u
> as it breaks the unix philosophy. Well
> it is a bit cohesive so it's not too bad.
>> Anyway "sort -u" is the same as "sort | uniq"
> not "sort | uniq -u"
To put a mathematical slant on this,
from a set operations point of view:
uniq = union
uniq -u = difference
uniq -d = intersection
Also python is getting set operations
built into the language soon, wahoo!
http://www.python.org/peps/pep-0218.html
Padraig.
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!