我有2个文件:
字符串列表:
ben
john
eric
Run Code Online (Sandbox Code Playgroud)
几行:
ben when to school
my mother went out
the dog is big
john has FB
eric is nice guy
Run Code Online (Sandbox Code Playgroud)
expoted文件:
my mother went out
the dog is big
Run Code Online (Sandbox Code Playgroud)
我想使用grep -v并删除列表中包含字符串的行.
这是想法,但错误的命令:
grep -v `cat file2` file1 > out
Run Code Online (Sandbox Code Playgroud)
谢谢
阿萨夫
使用文件模式:
grep -v -f "file2" file1 > out
Run Code Online (Sandbox Code Playgroud)
或者你可以这样做:
grep -v -e "string1" -e "string2" file1
Run Code Online (Sandbox Code Playgroud)