Remove Pipe-Delimiters from Text File

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of foncesa john foncesa john 2 years, 1 month ago.

  • Author
    Posts
  • #20060
    Profile photo of foncesa john
    foncesa john
    Participant

    Hi,

    I have created a script to insert the pipe-delimiters in text file, the purpose for that is search in text file which is successful, now i want to restore it back to its original text file with removing all pipe delimiters inserted.
    Is there a simple way to remove all the pipe delimiters in a single go.

    Thanks in advance.

  • #20062
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    Something like this should do the trick:

    (Get-Content .\file.txt) -replace '\|' | Set-Content .\file.txt
    
  • #20063
    Profile photo of foncesa john
    foncesa john
    Participant

    Hi,

    Thanks, so simply and faster, Amazing.

    Thanks a lot.

You must be logged in to reply to this topic.