I am trying to run an expression to match a particular line of text in a file, then capture the entire rest of the file using a perl one-liner:
For example, in the following file, I want to match starting at Header2 (ie the first header after ".X-Intermail-Unknown-MIME-Type=unparsedmessage" to the end of the file.
<lsmothers@example.com> SMTP 0<001501c4db9b$db8b2680$2d01a8c0@ryand9v889t9uc> .X-Intermail-Unknown-MIME-Type=unparsedmessage Header2: <headertwo@example.com Received: from server.cluster1.example.com ([10.20.201.160]) line 12
EVERYTHING I have done around this does not catch it. An example of what I have tried is below. From what I read, I think the below method should work:
$ cat sample.txt | perl -wnl -e '/\.X\-Intermail\-Unknown\-MIME\-Type\ +=unparsedmessag(e.*)/s and print $1;' e
The above returns only the e character, and I did that on purpose to make sure the string is matched. I am using the s modifier after the expression, which would categorize "newline" as "any".
Can anyone give me any suggestions? Thanks, RobertIn reply to regular expression - grabbing everything problem by notorious
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |