Link to home
Start Free TrialLog in
Avatar of whargra
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
ASKER CERTIFIED SOLUTION
Avatar of Steve Knight
Steve Knight
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of whargra
whargra

ASKER

It does not cut and paste the entire line so trying to figure out why.
Avatar of whargra

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.
No problem, not here much at the mo. so someone else will probably pick it up but will keep an eye out.
Steve