根据某种模式将文件拆分为多个文件 [英] Splitting a file into multiple file based on some pattern

查看:54
本文介绍了根据某种模式将文件拆分为多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文本文件如下:

shfhsgfkshkjg

gkjsfkgkjfgkfg

model1

lkgjhllghfjgh

kjfgkjjfghg

endmodel

model2

jfhkjhcgbkcjg

xhbgkxfkgh

endmodel <每个模型和endmodel之间需要
i,新文件中的文本应该是什么。文件名应该类似于model1,model2 ....模型可能是100或更多。请帮助我。

the text file is like:
shfhsgfkshkjg
gkjsfkgkjfgkfg
model1
lkgjhllghfjgh
kjfgkjjfghg
endmodel
model2
jfhkjhcgbkcjg
xhbgkxfkgh
endmodel

i want between each model and endmodel ,what is the text should be in the new file.and file name should be like model1,model2....model may be 100 or more.please help me.

推荐答案

在两者之间,它看起来像模型。两者之间是一样的。您可以编写正则表达式或解析文件以匹配字符。
Between the two, it looks like "model" is the same between. You could either write a regex or parse the file for matching characters.


但是每次都要编写新的文本文件。
but how to write for making the new text file each time.


文件可以写成如下:
The file could be written something like:
展开 | 选择 | Wrap | 行号


这篇关于根据某种模式将文件拆分为多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆