给定一个大日志文件,grep 文本块的最佳方法是什么?
text to be ignored
more text to be ignored
--- <---- start capture here
lots of
text with separators like "---"
---
spanning
multiple lines
--- <---- end capture here
text to be ignored
more text to be ignored
什么是已知的?
- 行中的最大字符数(55 个但可能更少)
- 块中的行数
- 分隔符(可能会重复)
什么正则表达式会匹配这个块?期望的输出:文本块列表。
请假设 Linux 命令行环境