Select-String

Please Visit: http://lifelongprogrammer.blogspot.com



Learning PwoerShell COmmands: Select-String and Measure-Object

Select-String

http://technet.microsoft.com/en-us/library/hh849903.aspx select-string -path $pshome\en-US\*.txt -pattern "@"

$f = select-string -path audit.log -pattern "logon failed" -context 2, 3

$f.count

(select-string -path audit.log -pattern "logon failed").count

Select-String C:\Scripts\Test.lxt -pattern "failure" -context 2

Select-String C:\Scripts\Test.lxt -pattern "failure" -context 3,1



Measure-Object

http://technet.microsoft.com/en-us/library/hh849965.aspx

Display the number of characters, words, and lines in the Text.txt file.

get-content C:\test.txt | measure-object -character -line -word

get-childitem | measure-object -property length -minimum -maximum -average

import-csv d:\test\serviceyrs.csv | measure-object -property years -minimum -maximum -average



from Google Plus RSS Feed for 101157854606139706613 http://technet.microsoft.com/en-us/library/hh849903.aspx

via LifeLong Community

No comments:

Post a Comment