我在这里搜索了类似的主题,但大多数问题都包含单字符分隔符。
我有这个文本样本:
Some text here,
continuing on next lineDELIMITERSecond chunk of text
which may as well continue on next lineDELIMITERFinal chunk
Run Code Online (Sandbox Code Playgroud)
所需的输出是一个列表 ( extracted=()
),其中包含:
Some text here,
continuing on next line
Second chunk of text
which may as well continue on next line
Final chunk
从示例中可以看出,“DELIMITER”用作分割分隔符。
我在 SO 上尝试了许多示例,包括 awk、替换等。
如果您不想更改默认RS
值,请尝试以下操作。
awk '{gsub("DELIMITER",ORS)} 1' Input_file
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2304 次 |
最近记录: |