LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] File Difference

[ILUG] File Difference

Padraig Brady padraig.brady at corvil.com
Thu Oct 31 14:53:07 GMT 2002


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.




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


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!
RSS Version
Powered by Dell