求救:shell script/awk question

I have one .csv file “file1” of 3 columns. And another file “file2” of 4 columns. I want to compare the first 3 columns of these two files and print out lines in file 2 where the first 3 columns don’t exist in file 1. This is my code: awk -F”,” ‘NR==NFR{a[$1,$2,$3]=$1$2$3;next} {if(!a[$1,$3,$3]=$1$2$3) {print $0}}’ file1 file2 If the files are delimited by space, the script works. It just doesn’t work for csv. similarly, egrep works fine if the delimiter of the files is space, but not csv files. egrep -vf file1 file2 哪位大拿有高招?试了无数次,恼火的很。

所有跟帖: 

改成shell script笨办法解决问题了。谢谢 -贝加儿湖畔- 给 贝加儿湖畔 发送悄悄话 (0 bytes) () 04/25/2018 postreply 20:31:35

请您先登陆,再发跟帖!