awk 'NR==FNR{a[$3]=$0;next}{if($2 in a)print a[$2],$0}' file1 file2
awk 'NR==FNR{a[$3]=$0;next}($2 in a){print a[$2]}' file1 file2
awk 'NR==FNR{a[$2]=$0;next}!($3 in a){print $0}' file2 file1
awk 'NR==FNR{a[$3]=$0;next}!($2 in a){print $0}' file1 file2
awk 'NR==FNR{a[$3]=$0;ind[$3]};NR>FNR{b[$2]=$0;ind[$2]}END{for(i in ind){if(a[i]&&b[i]){print a[i],b[i]}}}' file1 file2
awk 'NR==FNR{a[$3]=$0;ind[$3]};NR>FNR{b[$2]=$0;ind[$2]}END{for(i in ind){if(a[i]&&!b[i]){print a[i],b[i]}}}' file1 file2
awk 'NR==FNR{a[$3]=$0;ind[$3]};NR>FNR{b[$2]=$0;ind[$2]}END{for(i in ind){if(!a[i]&&b[i]){print a[i],b[i]}}}' file1 file2
awk 'NR==FNR{a[$3]=$0}NR>FNR{b[$2]=$0}END{for(i in a) for(j in b) if(i==j) print a[i],b[j]}' file1 file2
awk 'NR==FNR{a[$3]=$0}NR>FNR{b[$2]=$0}END{for(i in a){ flag=0;for(j in b) {if(i==j){flag=1}} if(!flag)print a[i]}}' file1 file2
awk 'NR==FNR{a[$3]=$0}NR>FNR{b[$2]=$0}END{for(j in b){ flag=0;for(i in a) {if(i==j){flag=1}} if(!flag)print b[j]}}' file1 file2
awk 'NR==FNR{a[$3]=$0;next}{b[$2]=$0}END{for(j in b){flag=1;for(i in a){if(i==j){flag=0}}if(flag)print b[j]}}' file1 file2
awk 'NR==FNR{a[$3]=$0;next}{b[$2]=$0}END{for(i in a){flag=1;for(j in b){if(i==j){flag=0}}if(flag)print a[i]}}' file1 file2
awk 'NR==FNR{f1[$3]=$0;next}$2 in f1{printf $0"\t"f1[$2] RS > "outfile1";delete f1[$2];next}{print > "outfile3"}END{for(s in f1)print f1[s] > "outfile2"}' file1 file2
阅读(1329) | 评论(0) | 转发(0) |