Selects patterns of text in an input file.
Select-Pattern [-Path <String>] -PatternOption <String> [-ExcludePattern <String>] [-Line] [-Sorted] [-Unique]
[<CommonParameters>]
Select-Pattern [-Path <String>] -Pattern <String> [-ExcludePattern <String>] [-Line] [-Sorted] [-Unique]
[<CommonParameters>]
Use the Select-Pattern
cmdlet to select patterns of text in an input file.
Patterns can be selected from a list of predefined options or specified as a
custom pattern.
Select-Pattern -Path 'C:\Temp\TMCTools.log' -PatternOption 'AnyKey'
Prints a list of TMC keys matched in C:\Temp\TMCTools.log
.
Select-Pattern -Path 'C:\Temp\1.log' -Pattern 'Converter version' -Line
Prints the line containing the engine version in C:\Temp\1.log
.
A pattern to exclude from matching.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
By default, Select-Pattern
only prints the matching string. Use the -Line
option to print the entire line containing the matching string.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies the path to a file to search.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies a custom search pattern.
Type: String
Parameter Sets: Custom
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies a predefined search pattern.
Type: String
Parameter Sets: Predefined
Aliases:
Accepted values: ProdKey, TrialKey, AnyKey
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
By default, Select-Pattern
returns results in the order in which they are
found. Use -Sorted
to sort them.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
By default, Select-Pattern
returns all results. Use -Unique
to only return
unique results.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.