I have 2 text file and want remover lines in file A which contain the strings in file B
file A:
joe ball 1335
john dyer 1365
dylan fisher 1795
ian gill 1913
eric kelly 1101
file B:
1795
1913
And I want Bash code get result like this:
joe ball 1335
john dyer 1365
eric kelly 1101
I try this codes but the answer did not work out
$ grep -vwF -f A B
$ awk -F'[ ,]' 'FNR==NR{a[$1];next} !($4 in a)'
It uses space as field separator, and
$1
is the first column element of a line,$3
is the 3rd column element of the line. use arraya
store fileB elementsa[$1]
. checks the 3rd column element of fileA whether in arraya
, if not print the whole line Output: