Is this even possible to do with PowerShell?

Welcome Forums General PowerShell Q&A Is this even possible to do with PowerShell?

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
2 years, 6 months ago.

  • Author
    Posts
  • #56926

    Participant
    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    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
    Ron

    Participant
    Topics: 0
    Replies: 199
    Points: 2
    Rank: Member

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

    $x="1234567890"
    $y=$x.ToCharArray()
    5..7|%{$y[$_] = '*'}
    $x = $y -join ''
    $x
    

    Just remember that the array is base 0.

  • #56944

    Participant
    Topics: 1
    Replies: 1
    Points: 0
    Rank: Member

    I'll give that a try.

    Thanks!

The topic ‘Is this even possible to do with PowerShell?’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort