Powershell Amateur (AT BEST) needs some help

Good afternoon all;

My developer left the company and unfortunately a good chunk of the stuff he was working on has fallen to me. As such, I have a question which some of you wizards probably know the answer to.

Situation: I have an undelimited, fixed length file (39 characters wide), approximately 2 million lines provided to us by our illustrious government. I need to be able to either insert commas at 13 character intervals and once that is done, I need to be able to insert decimal points two characters from the right of column 2 and 3. I have actually figured out how to do everything else that I need to do but these two items are kicking my posterior (and hurting my pride).

 

Any help you could offer would be greatly appreciated!

So you are working with strings. You could use the Substring() method to cut a long string into smaller pieces for further use.
If you’d show your code we might be able to tweak it a little bit for you.

Thanks Olaf - I ended up figuring this one out doing using substrings as you mentioned. My script is not elegant but it does work. :slight_smile:

Rcoil26,

Provide us the script to review and see what we can do to make it better? Once the script works the next step is to increase efficiency. I would recommend you to study the Measure-Command commandlet. It’s a great command to measure how long a command/ script takes to run.