C
Cheyne Li
Hi, everyone
My code opens a file and read line by line to find a given string as
first match. After I found one, how can i find the second match, a
different string, which is supposed to appear several lines after the
line of first match in a fast way?
for example, the following is the contents of a file
ka;sdfjaskf;asdfjk
skdfkfkfkfkfkfkfkfkfk
aks;flasjklfjkassjfksa
aaaaaaaaaaaaaaaaaaaaaaaa
bbbbbasdfdask;fjsdkalf
*************hello world***************ka;sdjkf;sjadkfj
asdfkasjdkfldjaskl;jfklas;
jaskdl;fjkasdjkfljdskla;jdfs
jkasl;jfkasjdklfjsal;df
asjkdfjkasd;fd;asdfj
***********Ruby*********a;sjdfklsdjal;fjkda;
asdfjjasklfjkdasjkfjaskl;
fjdka;dfdjasjfsd;a
So, after I found the match "hello world" by using a while loop, how can
i find the "Ruby" in the same while loop?
Looking forward to your reply. Thanks in advance
My code opens a file and read line by line to find a given string as
first match. After I found one, how can i find the second match, a
different string, which is supposed to appear several lines after the
line of first match in a fast way?
for example, the following is the contents of a file
ka;sdfjaskf;asdfjk
skdfkfkfkfkfkfkfkfkfk
aks;flasjklfjkassjfksa
aaaaaaaaaaaaaaaaaaaaaaaa
bbbbbasdfdask;fjsdkalf
*************hello world***************ka;sdjkf;sjadkfj
asdfkasjdkfldjaskl;jfklas;
jaskdl;fjkasdjkfljdskla;jdfs
jkasl;jfkasjdklfjsal;df
asjkdfjkasd;fd;asdfj
***********Ruby*********a;sjdfklsdjal;fjkda;
asdfjjasklfjkdasjkfjaskl;
fjdka;dfdjasjfsd;a
So, after I found the match "hello world" by using a while loop, how can
i find the "Ruby" in the same while loop?
Looking forward to your reply. Thanks in advance