相关疑难解决方法(0)

我怎样才能在文件中搜索这个或那个(2 件事)?

我有一个包含“then”和“there”的文件。

我可以

$ grep "then " x.x
x and then some
x and then some
x and then some
x and then some
Run Code Online (Sandbox Code Playgroud)

我可以

$ grep "there " x.x
If there is no blob none some will be created
Run Code Online (Sandbox Code Playgroud)

如何在一次操作中同时搜索两者?我试过

$ grep (then|there) x.x
Run Code Online (Sandbox Code Playgroud)

-bash: 意外标记附近的语法错误`('

grep "(then|there)" x.x
durrantm.../code
# (Nothing)
Run Code Online (Sandbox Code Playgroud)

grep regular-expression

55
推荐指数
2
解决办法
8万
查看次数

标签 统计

grep ×1

regular-expression ×1