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 11:28:07 GMT 2002


Kieran OSullivan wrote:
> I have 2 files a.txt and b.txt. b.txt is a subset of a.txt however they are not sorted in the same order e.g. "xyz.com" will be in b.txt on line 20 and in a.txt on line 30.  I have tried using a diff command such as
> 
> diff --side-by-side --suppress-common-lines -i a.txt b.txt
> 
> This appeared to work until I took a good look at my results.
> 
> What I am looking for is a command or program, which will look at a.txt and b.txt, eliminate all the stuff in b.txt regardless of its position and display the result.
> 
> E.g a.txt ={a,b,c,d} b.txt={a,b,c}
> $command a.txt b.txt 
> displays {d}

Well if you don't mind uniqifyind lines within files:

cat a.txt b.txt | sort | uniq -u

Otherwise you need to use comm

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