小编Asa*_*f S的帖子

grep -v文件中的多个字符串

我有2个文件:

  1. 文件1

字符串列表:

ben
john
eric
Run Code Online (Sandbox Code Playgroud)
  1. 文件2

几行:

 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)

谢谢

阿萨夫

bash shell ksh

1
推荐指数
1
解决办法
6048
查看次数

标签 统计

bash ×1

ksh ×1

shell ×1