View Single Post
Old 12-30-2007   #4 (permalink)
Kiron


 
 

Re: Searching for content in text files with powershell

Use Select-String's -Quiet switch --it returns a boolean value-- and filter the files that match with Where-Object to set their content to the new file:

set-content E:\test.txt (
get-childItem *.txt |
where {select-string $term $_ -quiet} |
get-content
)

--
Kiron
My System SpecsSystem Spec