我有一个包含以下几行的文件:
string
string
string
MODEL 1
.
.
.
TER
string
string
string
MODEL 2
.
.
.
TER
那里有 5000 个这样MODEL
的 s。我想拆分这个文件,以便每个部分的开头MODEL X
和结尾TER
(用点显示)都保存到自己的文件中,而其他所有内容都被丢弃。我怎样才能做到这一点?可能与awk
or split
?
我检查了其他几个类似的问题,但未能将答案应用于我的案例。
另请注意,我使用的是 Mac OS X。