bash - How do I prevent this infinite loop in PowerShell? -
say have several text files contain word 'not' , want find them , create file containing matches. in linux, might do
grep -r not *.txt > found_nots.txt
this works fine. in powershell, following echos want screen
get-childitem *.txt -recurse | select-string not
however, if pipe file:
get-childitem *.txt -recurse | select-string not > found_nots.txt
it runs ages. ctrl-c exit , take @ found_nots.txt file huge. looks though powershell includes output file 1 of files search. every time adds more content, finds more add.
how can stop behavior , make behave more unix version?
use -exclude
option.
get-childitem *.txt -exclude 'found_nots.txt' -recurse | select-string not > found_nots.txt
Comments
Post a Comment