Copy lines between two keywords

Hi, I want to copy lines between two keywords from a text file and save it as a new word file with the keyword as the file name.
PMMMMxxxxxxxxxxxx- Space for some text.
(1) A (2) B (3) C (4) D (5) E
This is a single choice vote.
Satish: https://google.com/ talks
Satish voted for: Close
Satish ended the vote - results:

“PMMMMxxxxxxxxxxxx-” and “ended the vote - results:” are the keywords. There will be multiple such inputs in one text file and each should be copied in one individual word file. Need help in reading the text between the two keywords.

Hi @Indumathi,

Welcome to out Community!

You can check the attached xaml, using substring function I have created the process.
You need to have the text file in your desktop and rename the file as per the workflow for testing purpose.

StringBetween2Words.xaml (5.4 KB)

Thank you so much for your guidance. How do I put this in a loop for multiple such inputs in a file and for each input it reads and writes in individual file.

@Indumathi,

Do you have separate keywords for each file or common keywords for all the files.

Keywords are different. It is like a unique reference id with a common format. First keyword starts with “P” and ends with “-” (ex:PMMMMxxxxxxxxxxxx-). Second one is common one - “ended the vote - results:”

@Indumathi,

Check this one, You need to do the logic to pass different keywords for each file.
I do not have idea from where you are getting the keywords.(ex: Excel, database)
ExtractStringOutput.xaml (8.3 KB)

Original file is a PDF. I planned to read the data and copy to text file and then manipulate to read each case with the unique keyword and copy to individual word files. Is that ok

From where you will get this one, as of now I have used those two keywords you have mentioned in this post.

If we have multiple keywords, do we need to check all those in a file before extract?

Original file is a PDF. It is like reference id, for example there are set of test cases in a PDF document with multiple pages and for each test case unique Id will be provided. Each test case needs to be copied in individual files with the file name as Refence Id.I planned to read the whole data from PDF and copy to text file and then manipulate to read each case with the unique keyword and copy to individual word files. Is that ok

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.