Select-String


Lets you search through strings or files for patterns.

Snap-In: Microsoft.PowerShell.Utility

Syntax:

Select-String

 [-Pattern] <String[]> -InputObject <PSObject> [-SimpleMatch] [-CaseSensitive] [-Quiet] [-List] [-Include <String[]>] [-Exclude <String[]>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] 

Select-String

 [-Pattern] <String[]> [-Path] <String[]> [-SimpleMatch] [-CaseSensitive] [-Quiet] [-List] [-Include <String[]>] [-Exclude <String[]>] [-Verbose] [-Debug] [-ErrorAction <ActionPreference>] [-ErrorVariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] 

Description:

Objects provided by the pipeline or by the InputObject parameter, or a string presented by the -Text parameter are checked to see if they are a fileInfo object. If so, the file is read and the strings from it are checked. If the incoming objects are MatchInfo objects, the Line property is searched. If matched, the MatchInfo object is sent to the pipeline if appropriate. Otherwise, the object's ToString() method is called and the resulting string is checked. The matching is done in the current culture. If -SimpleMatch is false (the default case), a regular expression match is performed; otherwise, a simple string match is performed. If -CaseSensitive is false (the default case), the case of alphabetic character s is ignored in comparing them. If -List is false (the default condition), an output match object will result f or every match found in each file. If it is true, only one match object will result for each file evaluated, and the line numbers, string matched, and pattern will be set in these objects to the first found. Evaluation of each file stops at that point, for efficiency. If -Quiet is true, all the above mentions of output are overridden; only a Boolean is sent down the pipeline, true if the pattern was found and false otherwise. In this situation, the cmdlet stops processing at the first successful match and returns true. If both -List and -Quiet parameters are given, the match object for the first match is returned. The MatchInfoclass's ToString() method operates differently if the MatchInfo is operating on file contents. In this case, it displays "{0}:{1}:{2}", filename, lineNumber, line. However, when it is operating on objects or strings, it will simply give the line property of the MatchInfo object. The display mechanism displays MatchInfo objects in this format.



Windows PowerShell. TFM
Internet Forensics
ISBN: 982131445
EAN: 2147483647
Year: 2004
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net