Hi,
I am new to Perl and trying to figure out how I can select a block of text and extract some data out of it. All blocks are the same; they are \n\n apart from each other and start with string "Processing..."
I want to extract what comes after "Processing.....:",
tab what comes after "Phrase:"
tab, what comes underneath of "Meta Mapping (some digit)", if there are more than one phrase, same process happens and "Process..:" data being repeated for all phrases until it reaches \n\n.
So, for the block below I should get two rows, in the first column "Mental status change over the last 5 days" being repeated in row 1 and 2, the "phrase:" results appear in column 2, and the line below "meta mapping" appears in the third column (which is "none" for the second row. The loop should jump to the next block until the end of the file. "meta candidate" results can be ignored.
I'd appreciate any help/hint
Processing 00000000.tx.2: Mental status change over the last 5 days.
Phrase: "Mental status change"
Meta Mapping (1000)
1000 D0072276:MENTAL STATUS CHANGE (ALTERED MENTAL STATUS) (Mental or Behavioral Dysfunction)
Phrase: "over the last 5 days."
Meta Candidates (0): <none>
Meta Mappings: <none>
Processing 00000000.tx.1:........
output
Mental status change over the last 5 days (tab) Mental status change (tab) 1000 D0072276:MENTAL .......
Mental status change over the last 5 days (tab) over the last 5 days (tab) none