Dec-13-2016, 10:22 AM
I have a requirement were in i need to print the lines between 2 patterns into files
The text in the below format is available in a file. The requirement is to create a new file for each "StartPattern" and write the lines after it into the file till the "EndPattern" is reached. The StartPattern names change but the EndPattern is a constant string. I'm new to python so unable to get a complete program to do it
<StartPattern1>
line1
line2
line3
line4
<EndPattern>
<StartPattern2>
line1
line2
line3
<EndPattern>
....
....
....
Example Output
============
1. StartPattern1.txt
2. StartPattern2.txt
The text in the below format is available in a file. The requirement is to create a new file for each "StartPattern" and write the lines after it into the file till the "EndPattern" is reached. The StartPattern names change but the EndPattern is a constant string. I'm new to python so unable to get a complete program to do it
<StartPattern1>
line1
line2
line3
line4
<EndPattern>
<StartPattern2>
line1
line2
line3
<EndPattern>
....
....
....
Example Output
============
1. StartPattern1.txt
2. StartPattern2.txt