Remove lines from text file if it contains string Powershell -
i trying remove lines text file contains partial string using below powershell
get-content c:\new\temp_*.txt | select-string -pattern "h|159" -notmatch | out-file c:\new\newfile.txt the actual string h|159|28-05-2005|508|xxx , repeats in file multiple time , trying match first part specified above. correct? getting empty in output.
am missing something...please help.. badly stuck
escape | character using backtick
get-content c:\new\temp_*.txt | select-string -pattern 'h`|159' -notmatch | out-file c:\new\newfile.txt powershell powershell-v2.0 powershell-v3.0
No comments:
Post a Comment