I want to delete lines in FILE1 contains pattern in FILE2.
How do I do this using shell/bash or Tcl?
For example:
FILE1:
This is ECO_01
This is ECO_02
This is ECO_03
This is ECO_04
FILE2:
ECO_02
ECO_04
Output:
This is ECO_01
This is ECO_03
most generic solution will be
$ grep -vf file2 file1
note that any substring match on any field will count. If you only restrict to exact match on an exact field (here assumed the last)
$ awk 'NR==FNR{a[$1]; next} !($NF in a)' file2 file1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With