I am trying to parse some xml log entries and export the data as rows in a CSV file. The format of the input file looks like:
The Messages envelope contains a couple of thousands of Message children.
I am trying to extract the values of two attributes in their raw form and for the third attribute I want to apply a regular expression that captures a group and retain the group match. E.g. The custom object I would like to end up in the end should have attributes "value1", "value2", and Regex group match of "value3".
This yields a csv file with three columns, one for each property. What I really need is that the third column be the capture group applied on the value in '#cdata-section'. How do I apply the capture group in the overall query?
I am a complete beginner and I thank you in advance for your time.
Well, without being able to see the sample data this can't be exact, but in general, you can use a calculated property with Select-Object to do your RegEx on '#cdata-section'. It could look something like this.