如何获取文件中的行? [英] How to get the inbetween lines in a file?

查看:71
本文介绍了如何获取文件中的行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我有这样的文件..


start

bla bla bla1

start1

bla bla bla2

bla bla bla3

end1

bla bla bla4

bla bla bla5

start2

bla bla bla6

bla bla bla7

end2

bla bla bla8

结束

从此我想得到start1和end1之间的行,即我想要的是as关闭


bla bla bla2

bla bla bla3


这样的文件有n个套装..


可以指导我这个吗?


谢谢和问候,

Dheena。

Hi Every One,

I am having a file like this..

start
bla bla bla1
start1
bla bla bla2
bla bla bla3
end1
bla bla bla4
bla bla bla5
start2
bla bla bla6
bla bla bla7
end2
bla bla bla8
end
from this i want to get the lines inbetween start1 and end1 i.e what i want is as follows

bla bla bla2
bla bla bla3

like this the file has n number of sets..

can any guide me regarding this?

Thanks and Regards,
Dheena.

推荐答案


大家好,


我有这样的档案..


开始

bla bla bla1

start1

bla bla bla2

bla bla bla3

end1

bla bla bla4

bla bla bla5

start2

bla bla bla6

bla bla bla7

end2

bla bla bla8

end

从这个我想得到start1和end1之间的线路,即我想要的是如下


bla bla bla2

bla bla bla3


这样的文件有n个套装..


可以指导我这个吗?


谢谢和问候,

Dheena。
Hi Every One,

I am having a file like this..

start
bla bla bla1
start1
bla bla bla2
bla bla bla3
end1
bla bla bla4
bla bla bla5
start2
bla bla bla6
bla bla bla7
end2
bla bla bla8
end
from this i want to get the lines inbetween start1 and end1 i.e what i want is as follows

bla bla bla2
bla bla bla3

like this the file has n number of sets..

can any guide me regarding this?

Thanks and Regards,
Dheena.



到目前为止你尝试过什么?您可以使用正则表达式跳过这些行,直到符合条件并打印行直到满足其他条件。

What have you tried so far? You can make use of regex to skip the lines until a criteria is met and to print lines until other criteria is met.


Hi Nithinpes,


是的我知道正则表达式..


但是正则表达式将使用单个字符串..


我需要的是,我想得到这些行之间的行(start1和end1),就像它有n个数字..


我想在字符串数组中获取这些字符串(即)在这两行之间..


谢谢和问候,

Dheenaalex
Hi Nithinpes,

yes i know the regular expressions..

But the regular expressions will work with a single string..

what i need is, i want to get the lines in between those lines(start1 and end1), like that its having n number..

I want to get those strings in a array of string (i.e) inbetween those two lines..

Thanks and Regards,
Dheenaalex



嗨Nithinpes,


是的我知道正则表达式..


但是正则表达式可以使用单个字符串。 。


我需要的是,我想在这些行之间获取行(start1 an d end1),就像它有n个数字..


我想在这两行之间的字符串(即)数组中获取这些字符串..


谢谢和问候,

Dheenaalex
Hi Nithinpes,

yes i know the regular expressions..

But the regular expressions will work with a single string..

what i need is, i want to get the lines in between those lines(start1 and end1), like that its having n number..

I want to get those strings in a array of string (i.e) inbetween those two lines..

Thanks and Regards,
Dheenaalex



要获取start1和end1之间的行(例如),请尝试以下操作:

To get lines between start1 and end1(e.g), try the following:

展开 | 选择 | Wrap | 行号


这篇关于如何获取文件中的行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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