1.文件1
[root@bi-3 bin]# cat push
TCL_P728M TCL 74eda717a4aef660f362f1806eb85d9d
TCL_S720_JB2 TCL ecb6724875f6361466f4e91df603f06c
TCL_P728M TCL f654f6d4f2157a658c0d7f688bb074b8
TCL_P728M TCL d8ed297d1a0a405434e49f66d00d92ae
TCL_P728M TCL 5afcdd7b3eec3e15e636e3c7f249938a
2.文件2
[root@bi-3 bin]# cat cru
d8ed297d1a0a405434e49f66d00d92ae 5
f654f6d4f2157a658c0d7f688bb074b8 2
74eda717a4aef660f362f1806eb85d9d 15
3.合并结果
[
root@bi-3 bin]# awk '{if(NR==FNR){a[$3]=$0} else{a[$1]=a[$1]"|"$2}} END{for(i in a) {print a[i]}}' push cru
TCL_P728M TCL f654f6d4f2157a658c0d7f688bb074b8|2
TCL_S720_JB2 TCL ecb6724875f6361466f4e91df603f06c
TCL_P728M TCL 74eda717a4aef660f362f1806eb85d9d|15
TCL_P728M TCL 5afcdd7b3eec3e15e636e3c7f249938a
TCL_P728M TCL d8ed297d1a0a405434e49f66d00d92ae|5
TCL_P728M TCL f654f6d4f2157a658c0d7f688bb074b8|2
TCL_S720_JB2 TCL ecb6724875f6361466f4e91df603f06c
TCL_P728M TCL 74eda717a4aef660f362f1806eb85d9d|15
TCL_P728M TCL 5afcdd7b3eec3e15e636e3c7f249938a
TCL_P728M TCL d8ed297d1a0a405434e49f66d00d92ae|5
ps.显示匹配上的结果的命令
awk 'NR==FNR{a[$3]=$0;next}{print a[$1]"|"$2}' push cru