我有两个文本文件:删除线包含从另一个文件采取了一定的字符串
File 1:
abc 1x21
和
File 2:
sdc 1x43
xcvyu 03x01
abc 1x21
xyz 4x23
,并希望得到
File 3:
sdc 1x43
xcvyu 03x01
xyz 4x23
找到东西在this thread类似,但它不适合我。
我有两个文本文件:删除线包含从另一个文件采取了一定的字符串
File 1:
abc 1x21
和
File 2:
sdc 1x43
xcvyu 03x01
abc 1x21
xyz 4x23
,并希望得到
File 3:
sdc 1x43
xcvyu 03x01
xyz 4x23
找到东西在this thread类似,但它不适合我。
尝试这一行:
awk 'NR==FNR{a[$0];next} !($0 in a)' file1 file2 > file3
没有测试,但应该工作。
最简单的解决,如果你GNU grep
:
$ grep -vxf file1 file2 > file3
sdc 1x43
xcvyu 03x01
xyz 4x23
这可能为你工作(GNU SED):
sed 's|.*|/&/d|' file1 | sed -f - file2 > file3