Logo

Documentation home for Transend tools

Select-Pattern

SYNOPSIS

Selects patterns of text in an input file.

SYNTAX

Predefined

Select-Pattern [-Path <String>] -PatternOption <String> [-ExcludePattern <String>] [-Line] [-Sorted] [-Unique]
 [<CommonParameters>]

Custom

Select-Pattern [-Path <String>] -Pattern <String> [-ExcludePattern <String>] [-Line] [-Sorted] [-Unique]
 [<CommonParameters>]

DESCRIPTION

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.

EXAMPLES

Example 1: Select matches using a predefined pattern

Select-Pattern -Path 'C:\Temp\TMCTools.log' -PatternOption 'AnyKey'

Prints a list of TMC keys matched in C:\Temp\TMCTools.log.

Example 2: Select matches using a custom pattern

Select-Pattern -Path 'C:\Temp\1.log' -Pattern 'Converter version' -Line

Prints the line containing the engine version in C:\Temp\1.log.

PARAMETERS

-ExcludePattern

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

-Line

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

-Path

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

-Pattern

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

-PatternOption

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

-Sorted

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

-Unique

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

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

None

OUTPUTS

System.Object[]

NOTES