learingperl01
MIS
Hello everyone,
I am hoping someone can shed some light/point me in the right direction. I am trying to figure out how to search for the 1st occurrences of two strings and once they are found print all previous data.
Below is some sample data which I would be working with, any pointers etc would be greatly appreciated as I don't even know how to get that started.
Right now what I am doing is having to run matches on each line that I want to match and print on.
what I would like to do is find the first occurrence of Subject: followed by the first occurrence of Content: and print all data prior to the 1st Content: match.
desired output below:
I am hoping someone can shed some light/point me in the right direction. I am trying to figure out how to search for the 1st occurrences of two strings and once they are found print all previous data.
Below is some sample data which I would be working with, any pointers etc would be greatly appreciated as I don't even know how to get that started.
Right now what I am doing is having to run matches on each line that I want to match and print on.
Code:
Sender: 123
Recipient: aaa
Date: 2009/03/04
Time: 08:20:01
Operator: test
Subject: test01
Content: data data
Subject: RE: test
Content: data2 data
Additional: additional data
what I would like to do is find the first occurrence of Subject: followed by the first occurrence of Content: and print all data prior to the 1st Content: match.
desired output below:
Code:
Sender: 123
Recipient: aaa
Date: 2009/03/04
Time: 08:20:01
Operator: test
Subject: test01