Hello,
I am attempting to parse data from a flat log file, Pull out the relevant information, and turn the remaining relevant information into something useful. I am pretty new to this and have no programming background.
The following is my basic scenario. I have a flat file with lines that look similar to the following:
A|B|C|D|E
A|C|D|E
A|B|C|D|E
A|B|C|D|E
A|C|D|E
I only want to pull objects from the file that contain the full A|B|C|D|E. So I wrote up a regex that searching for the pipe,B,pipe and assigned it to a variable. I then perform a get-content against the file with a select-string using the regex to filter for the objects I want. So far good to go. Now I run into problems.
I have this single string of data that is a matchinfo. I try to export it to CSV thinking then I can re-import the results as an array adding headers and the CSV output is garbage. I then switch it into a string… more garbage results. Tried out-file also… different garbage results.
Right now I am trying to figure out how to output the filtered content to a “clean” csv (Or even maintain it in memory and delimit the content by | 1-1 to an array with “tables”.
I don’t want anyone to write me up a full script of this, (This is purposely learn-as-i-go project) but I am completely stuck after tinkering with this for about half a waking day.