Aug 8, 2011, 4:27 PM
Post #1 of 5
perl regular expression cannot be matched?
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.
Received: from server.cluster1.example.com ([10.20.201.160])
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;'
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?