Remove Pipe-Delimiters from Text File

Welcome Forums General PowerShell Q&A Remove Pipe-Delimiters from Text File

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

 
Participant
4 years, 1 month ago.

  • Author
    Posts
  • #20060

    Participant
    Points: 0
    Rank: Member

    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

    Member
    Points: 0
    Rank: Member

    Something like this should do the trick:

    (Get-Content .\file.txt) -replace '\|' | Set-Content .\file.txt
    
  • #20063

    Participant
    Points: 0
    Rank: Member

    Hi,

    Thanks, so simply and faster, Amazing.

    Thanks a lot.

The topic ‘Remove Pipe-Delimiters from Text File’ is closed to new replies.