Select rows in a text file based on start and end words

Hi,

I have a log file which contains data like the below:

Person Name: User 1
Data

Data
Total:
Person Name: User 2
Data

Data
Total:

I want to use the ‘Select-String’ command in order to select all the rows starting from the row containing ‘User 1’ until ‘Total’ after ‘User 1’, and export all of these rows to a file named ‘User 1’, and all rows starting from the row ‘User 2’ until the row Total after ‘User 2’, and so on,

Anyone have an idea how this can be accomplished?

Thanks,
Amichai

pretty much doable, but I would suggest you to try something with Select-String by reading the Help documentation.
Folks here will definitely help when you get stuck.

You may watch this video to get an overview what’s possible with Powershell: Sophisitcated Techniques of Plain Text Parsing.