Using Get-Content
hi all, i'm trying write ps script read file , give me result lines of filtering whole file. i'm trying this code: $testo = get-content c:\myfile.txt | {$_ -like "*word*"} foreach-object {$line in $testo -replace(";" , ","} i receive thi error: + foreach-object {$line in <<<< $testo -replace (";" , ","} + categoryinfo : parsererror: (in:string) [], parentcontainserrorrecordexception + fullyqualifiederrorid : unexpectedtoken how can corret instruction ? sorry i'm newbie using powershell :-( you can/should able use 'where' filter foreach, long it's piped, mjolinor kind of hinted to. (ex.: get-content users.txt | where{$_ -like *@domain.com } | foreach-object{set-user -windowsemailaddress $null}) it should highly important note, though, trailing or leading blank/white spaces ...