输出B资料中包含A文件的记录-文件对比
输出B文件中包含A文件的记录-文件对比
需求:找出2.txt中包含1.txt中各行的数据行并输出到3.txt。
命令:
1.txt
2.txt
3.txt
需求:找出2.txt中包含1.txt中各行的数据行并输出到3.txt。
命令:
cat 1.txt | xargs -i grep {} 2.txt > 3.txt
1.txt
12 13 14 15 16 17 18 19 20
2.txt
10-abcdef10 11-abcdef11 12-abcdef12 13-abcdef13 14-abcdef14 15-abcdef15 16-abcdef16 17-abcdef17 18-abcdef18
3.txt
12-abcdef12 13-abcdef13 14-abcdef14 15-abcdef15 16-abcdef16 17-abcdef17 18-abcdef18