gpt4 book ai didi

regex - GREP - "dot match newline"选项?

转载 作者:可可西里 更新时间:2023-11-01 11:50:35 26 4
gpt4 key购买 nike

例子:

...
Line
some text
other text
10
...

是否可以告诉 GREP ^Line.*?^10$ 以便点也匹配换行符并且我得到以下输出:

Line
some text
other text
10

如果没有,是否有一些 Linux CLI 工具可以做到这一点?

最佳答案

如果您打算输出 Line10 之间的行,包括 Line,我建议使用 awk:

awk '/^Line$/,/^10$/' myfile

关于regex - GREP - "dot match newline"选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7413923/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com