【发布时间】:2018-11-26 20:50:12
【问题描述】:
嘿,我仍然是 sed 的初学者,我正在尝试使用 sed 脚本仅输出 1.txt 到 2.txt 中未找到的行(如果该行具有 /pattern/ )。我有以下内容:
1.txt
demo@example.de:boo
demo2@example.com:foo
demo3@example.nl:foo
2.txt
@example.de
@example.com
期望的输出是
demo3@example.nl:foo
我试过这些命令看起来不起作用
$ grep -f 2.txt 1.txt
$ cat 2.txt | xargs -I {} sed -n "/{}/p" 1.txt
【问题讨论】: