【发布时间】:2014-09-11 17:24:48
【问题描述】:
我有一个包含多个段落的文本文件,我想将其分割成单独的文件。它应该适用于 Linux 系统。
例如: 首先我有这个文件:
== 01.01.2014 ==
this is the text that should
go into
file one
and i like file one to be namend 01-01-2014
== 15.02.2014 ==
and this is the text that should
end up
in file two
where file two is named
15-02-2014
并且切割它应该有两个文件,名为 15-02-2014.txt 和 01-01-2014.txt 仅包含属于日期的文本部分,一个问题可能是中间有换行符和空行, 所以一个文件可以包含多个文本块
我认为使用 awk 会有一个解决方案,但我不知道如何将其保存到不同的文件中。 我的另一种方法是使用 libreoffice writer,但它的搜索和替换功能似乎不允许插入分页符。
【问题讨论】: