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.
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!