Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extract text between two keywords

Status
Not open for further replies.

nickjsomer2000

Technical User
May 9, 2013
1
GB
Good Afternoon,

I would like some help on how I can extract text between two keywords in a text file and then write the text to a output file.

Example

17th May 2013
67673647
SerialNumber
Start
SD
778
4456.56
NNDR
443
787.56
End
Import Finished

Keywords are Start and End

I want to extract all the text between Start and Finsh then write to a new file

Thanks
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Regular expressions with groups come to mind here.
Looping through the match collection should work nicely here - provided the file is all nicely ASCII coded.

“Knowledge is power. Information is liberating. Education is the premise of progress, in every society, in every family.” (Kofi Annan)
Oppose SOPA, PIPA, ACTA; measures to curb freedom of information under whatever name whatsoever.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top