+ Reply to Thread
Results 1 to 2 of 2

Thread: Search and replace text inside file

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    34

    Search and replace text inside file

    I have created a function that loop files and replace a words , it runs through and does exactly what I want, now I'm stuck.
    I can't seem to get it to open the newly created $NEW.shtml and replace a word with the variable $SPACE though.

  2. #2
    Junior Member
    Join Date
    May 2012
    Posts
    36
    Please try that....
    Code:
    (Get-Content "$NEW.shtml") | 
    Foreach-Object {$_ -replace 'word',$SPACE} | 
    Set-Content "$NEW.shtml"

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts