PS> 'abcjjadjjnamndabc' -replace 'abc', '$$'
PS> 'abcjjadjjnamndabc' | foreach { $_ + " end of statement" }
I have above 2 statements which can run independently, but I want to do this action in one attempt.
I did try something like below, but syntax is failing.
PS> 'abcjjadjjnamndabc' | foreach { $_ + "end of statement" } |-replace 'abc', '',''
-replacecan work with:('stringhere' | % {$_ + 'end'}) -replace 'abc''abcjjadjjnamndabc' | ForEach-Object { "$_ end of statement" -replace 'abc' }