|Syntactic Confectionery Delight|
Multiline RegExp. A Better Way?by shoness (Friar)
|on Feb 16, 2012 at 01:51 UTC||Need Help??|
shoness has asked for the wisdom of the Perl Monks concerning the following question:
I've run some jobs that print out statistics about memory usage during their life. I use "grep" to collect relevant data into a single file. I parse that file with Perl to pull out the data that I want and create a comma-separated-values file that I can operate on with a spreadsheet tool.
Each line of the output file contains one of the data elements I want to collect. There is lots of other data that I don't want. The input data looks like this:
From this data, I expect to create a line like this:
As you can see, it's sortof taking the original source data and turning it sideways, stripping off the descriptive and unwanted text. The position in the line tells me that.
My working solution is below. I just think that since "tmtowtdi", that "tMBABwtdi. I'd love to see your thoughts on what surely must be a very common task.