Is this even possible to do with PowerShell?

This topic contains 2 replies, has 2 voices, and was last updated by  Tony 1 year, 4 months ago.

  • Author
  • #56926


    Hello All,
    OK here is my situation. I have a text file that contains some sensitive information and I need to scramble that data. In the past I've worked with XML and CSV, which made doing this A LOT easier, but in this situation all I have to work with is a flat text file.
    I can pull the data I need and save that to another document. Now the data that needs scrambled lives in certain columns, but for the life off me I cannot figure out how to take the data that I've pulled using this command:

     get-content C:\Temp\ard20161022.txt | select-string -pattern '\d+G ' 

    and while it is in memory make the changes to the data that lives at those specific columns.
    The first set of data that needs scrambled starts at column 88 and ends at column 105, the second set starts at column 126 and ends at column 146.
    Thank you for any help or advice you can offer.

  • #56941


    No 100% sure I follow you, but try this and see if it leads to a solution.

    5..7|%{$y[$_] = '*'}
    $x = $y -join ''

    Just remember that the array is base 0.

  • #56944


    I'll give that a try.


You must be logged in to reply to this topic.