Powershell Delete String in text file -


i have file downloading daily want create script reads text file , deletes out lines containing string "---"

i started "(get-content l:\holdings.txt) | {$_ -ne "" | out-file holdings.txt"

this deletes blank lines without issue, tried

$del -like "*-*" "(get-content l:\holdings.txt) | {$_ -ne $del | out-file l:\holdings.txt" 

which though delete out of lines of data, whilst runs without error line not being deleted out...

i don't know if it's relevant line want delete second line comma delimited sql batch file automation.

the file reads follows

advice num ,bargain number
--------------------,-----------------

just try , give graphical representation trying resolve

any ideas?

regards

richard

solved it, quick amendment , here (get-content "l:\movement.txt") -notmatch "---" | out-file "l:\movement.txt"


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -