for every file in directory wish remove lines match regular expression (beginning |b example) using powershell.
i think can via get-childitem on directory, foreach-object, get-content , sort of if -match i'm struggling fit together.
any massively appreciated. first time i've ever written powershell script.
something below should in right direction
$files = get-childitem "c:\your\dir" foreach ($file in $files) { $c = get-content $file.fullname | { $_ -notmatch "^\|b" } $c | set-content $file.fullname }
Comments
Post a Comment