I’m pretty sure there are more sophisticated ways but I couldn’t find any yet … assumed the structure of our input file is not more complex than what you showed above …
Sure Olaf, I will try to paste the code in the write format, not much sure how to use the code format.
Anyways. I will try to show the sample file how it looks :
Simply use the “pre” tags as described in the very first and pinned post of the list of this forum: Read Me Before Posting! You’ll be Glad You Did!
You can use the “buttons” provided on the edit bar of the post editor when you create a post.
Now your sample data look different to what you initially posted. If they look different every time it will be hard to find a structure or an algorithm to parse them. Did you try my suggestion with the sample data you posted earlier?
That’s not that helpful. We cannot see your screen. We do not know what you’re doing. So either you will have to tell us or you have figure out by yourself.
Do your performance matrix log files look always the same? Do they have a certain structure with repeating patterns? Can you post a part of the real data here? (if yes - please format as code as well please. Use the “pre” button on the bar right above the post editor for)
seems like the txt file I have received from my tutor is not in a structured format, there are some instances where some columns have no values, and that is the reason I think, the script is throwing an exception.
BIJO DEV,
I doubt that convertfrom-string will help you in your case. You’d need a kind of structured data for that. The example data are almost structured. They just miss some commas. If you change it to this:
you’ll get the expected results.
Therefor I asked for the data you have to deal with. If they have a certain structure you might be able to parse them. If not you would probably be out of luck.
It works even if there are no values for the columns, but not if there are few columns itself is not available. Handling unstructured data is no so easy.
you are asking beginner questions. I’d recommend for you to make a little step back and take your time to learn the very basics of Powershell. That would even enable you to understand the help you get here or in StackOverflow. It’ beyond the scope of any forum to teach you to write Powershell scripts or to iteratively develop ready to use productive code for you.