BASH - Check if a number exists in one CSV and display warning if in new CSV -
so have 1 csv file contains following:
number,name,phone 11111,dr spoon, 0115 1234 567 11112,mrs eggface, 07711111111
and csv long list of numbers:
number 11145 15687 11598 11112
now need somehow check row in first csv doesn't exist in second, , if show me does. suggestions? cheers!
this print lines in file1
first field found in file2
:
$ awk -f, 'nr>1&&nr==fnr{a[$1];next}fnr>1&&($1 in a)' file2 file1 11112,mrs eggface, 07711111111
add block format printing like:
$ awk -f, 'nr>1&&nr==fnr{a[$1];next}fnr>1&&($1 in a){print $1,"in both!"}' f2 f1 11112 in both!
Comments
Post a Comment