档案1:
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5O'|'5042449534546015801549'
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5O'|'5042449534546015801677'
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5Q'|'5042449536906016501541'
'SR'|'2017-09-01 00:19:20'|'+05:30'|'1A3LA7015L6I'|'5042449603146028701541'
文件2:
'SR'|'2017-09-01 00:19:13'|'+05:30'|'1A3LA7015L5Q'|'5042449536906016501541'
'SR'|'2017-09-01 00:19:20'|'+05:30'|'1A3LA7015L6I'|'5042449603146028701548'
我想要的OutPut是A-B和B-A
我尝试了下面的命令,但它似乎无法正常工作..
var1=5
awk -F "|" -v col="$var1" 'NR==FNR{a[$2];next} !($col in a)' File1 File2
awk -F "|" -v col="$var1" 'NR==FNR{a[$2];next} !($col in a)' File1 File2
我得到了解决方案,我正在做的错误是在{a[$2];next}
中给出错误的列号
我必须比较第5列,它将像:
awk -F "|" -v col="$var1" 'NR==FNR{a[$5];next} !($col in a)' File1 File2
awk -F "|" -v col="$var1" 'NR==FNR{a[$5];next} !($col in a)' File1 File2