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 -->
  #1 (permalink)  
Old 08-14-2007
eltinator eltinator is offline
Registered User
 

Join Date: Jul 2007
Posts: 54
Post Comparing 2 list and deleting deuplicate entries

Hi,

I have a list of names and I want to basically take each name and search a given file to see if the name is in that file. If it is then delete the name from the list and if it isn't then leave it. Anyone know how to script something like this. Here's an example of what I mean:

List 1:
Tom
Bob
John
Dave

List 2:
Anthony
Ed
Bob
Dave

Comparing List 1 to List 2 results in List1 being:
Tom
John

And just to note, List 2 might not be a list, could just be a text document with the names in there but the script should work about the same way. Can anyone help with this? Thanks!

Last edited by eltinator; 08-14-2007 at 01:37 PM.. Reason: Correction
Reply With Quote
Remove advertisements
!!
!! Forum Sponsor