The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 08-14-2007
eltinator eltinator is offline
Registered User
 

Join Date: Jul 2007
Posts: 54
Quote:
Originally Posted by jim mcnamara View Post
Your example seems to be backwards from your worded request. List1 should be Tom John?

Anyway, one way to do what you seem to ask
Code:
grep -v -f List2 List1> newlist1; mv newlist1 List1
Quick question on this. It works nicely when there are just 2 list but what when I try it for a file that has some sentences it doesn't seem to work. For example, List1 is as above but List2 is something like:


List of names

Names:
Anthony
Ed
Bob
Dave

After running the command List1 is empty, like it couldn't match anything from List2 due to the added lines in the beginning. Any ideas? Thanks!

Last edited by eltinator; 08-14-2007 at 01:19 PM.. Reason: Mistake
Reply With Quote