![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Deleting the files comparing the creation dates | pssandeep | UNIX for Dummies Questions & Answers | 2 | 04-10-2008 07:54 AM |
| How to create a list of entries without vi | mpc8250 | Shell Programming and Scripting | 3 | 02-12-2008 11:56 PM |
| Searching list of entries in file for actual files in dir | not4google | UNIX for Dummies Questions & Answers | 2 | 10-18-2006 08:24 AM |
| Comparing a distinct value in 1 list with another list | manualvin | Shell Programming and Scripting | 6 | 06-22-2004 03:42 AM |
| deleting double entries in a log file | opusforum | Shell Programming and Scripting | 5 | 09-17-2002 12:02 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
|||
|
Quote:
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 |
|
|||
|
Ok further testing shows that the grep has problems when List2 has a line with nothing on it. Basically it works when there are no blank lines so doing something like:
Dave Bob Jim Tim doesn't work. Is there any way to fix grep for this? |