On Fri, Aug 25, 2006 at 04:47:07PM -0400, Kamaraju Kusumanchi wrote: >On Friday 25 August 2006 14:01, William O'Higgins Witteman wrote: >> I have two files, one very long and the other much shorter. Every line >> in the short file is also in the long file. What I need is a file with >> every line in the long file *not* in the short file. Is there an easy >> way to have vim provide me with my desired complementary file? >> >> Thanks. > >If you are not particular about using vim and if you are using a Linux like >OS, then you can do > >$diff temp1.txt temp2.txt | grep '^>' | cut -f 1 -d ' ' --complement > >For example > >$cat temp1.txt >This is temp1.txt >This is temp3.txt > >$cat temp2.txt >This is temp1.txt >This is temp2.txt >This is temp3.txt >This is temp4.txt > >$diff temp1.txt temp2.txt | grep '^>' | cut -f 1 -d ' ' --complement >This is temp2.txt >This is temp4.txt > >hth >raju
Thanks to all. Tim responded with what I had in mind, Mike responded with a nifty tool that I didn't know existed and Raju has given me a neat method of doing what I wanted and taught me about "cut" in the process. I ended up using "comm" 'cause it was quickest, and I don't have to do this more than twice, but I appreciate the other methods for their (hopefully) future utility. -- yours, William
