whargra
asked on
cut and paste line to new text file
I need to search for a word in a text file then cut and paste that line and any line after until either another word occurs or end of the file into a new text file.
So if looking for the word Production it would cut that and any line until it hit the word Staging or the end of the file:
blah
blah
blah
Production
blah
blah
blah
Staging
blah
blah
Production
blah
So the new text file would have:
Production
blah
blah
blah
Production
blah
And the old file would have:
blah
blah
blah
Staging
blah
blah
So if looking for the word Production it would cut that and any line until it hit the word Staging or the end of the file:
blah
blah
blah
Production
blah
blah
blah
Staging
blah
blah
Production
blah
So the new text file would have:
Production
blah
blah
blah
Production
blah
And the old file would have:
blah
blah
blah
Staging
blah
blah
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Data issue. So have that done.
I would like to add one more thing to this, so I will open a new question. Thanks for the help.
I would like to add one more thing to this, so I will open a new question. Thanks for the help.
No problem, not here much at the mo. so someone else will probably pick it up but will keep an eye out.
Steve
Steve
ASKER