troubleshooting Question

Powershell to format a file

Avatar of Leo Torres
Leo TorresFlag for United States of America asked on
PowershellC#.NET Programming
12 Comments2 Solutions298 ViewsLast Modified:
I need to read a file that looks like below and is turned into columns and rows so i can insert into a SQL table.

Here is a break down:
20   20070426     20070426        83100   msg
PP  YYYYMMDD YYYYMMDD      Code     501


After the msg if one exists the pattern repeats up to 25 times in 1 line

I have a sample here of raw data, Included an actual RAW file with what I would like the final data to look like.


202007042620070426 83100  501                                                                                                                                                                                                                                                                                                   
202007053120070531 99520  501   202007053120070531 53011        202007053120070531 4010         202007053120070531 2724                                                                                                                                                                                                         
202007051520070515 4241         202007051520070515 4019         202007051520070515 4439 
RAW-sample.txt
Formatted.xlsx
ASKER CERTIFIED SOLUTION
Qlemo
"Batchelor", Developer and EE Topic Advisor
Join our community to see this answer!
Unlock 2 Answers and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros