Delete line in file based on data in another file

Hi there

I would like to create a shell script to do the following:

  • delete a line in file1 if it contains the data string in file2
    eg: file1
    1 100109942004051510601703694 0.00 0.00
    2 100109942004051510601702326 0.00 0.00
    3 100109942004051510601702327 0.00 0.00
    file2
    1 3694
    2 3741
    3 3834
    In the above example line1 of file1 must be deleted because it contains the string of line1 in file2 "3694".
    Also, the data sting must be in position 24 in each line
    100109942004051510601703694 0.00 0.00
    for it to be deleted.
    Hope this is sufficient information for a possible solution.
    I never did any shell scripting before so the help would very much be appreciated. :slight_smile:
    Thanks

Use grep, check the the -v and -f option in the manpage.

Regards