小编twk*_*789的帖子

匹配后在线打印所有内容

我有一个大文本文件,中间包含一个唯一的字符串.我想要做的是使用grep打印字符串之后的所有内容.

cat textfile | grep "target_string"
This highlights target_string but prints the whole file

cat textfile | grep -o "target_string"
This prints only target_string

cat textfile | grep -o "target_string*"
This prints only target_string
Run Code Online (Sandbox Code Playgroud)

如何在target_string之后打印所有内容之前没有任何内容?

bash grep

28
推荐指数
4
解决办法
7万
查看次数

标签 统计

bash ×1

grep ×1