< Back
Search-Reject
Post
NAME Search-Reject
SYNOPSIS
Perform functional-style filter-to-reject operations on a sequence or stream of objects in a Powershell pipeline
SYNTAX
Search-Reject [-Expression] <ScriptBlock> [-InputObject] <Object[]> [<CommonParameters>]
DESCRIPTION
Apply the given ScriptBlock expression to each member of the pipelined InputObject, rejecting those for which the
expression is True.
PARAMETERS
-Expression <ScriptBlock>
The anonymous (in-place) or named (as variable) single-argument lambda function to be applied to each
InputObject element. This must have a single-argument parameter block.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InputObject <Object[]>
The sequence or stream of Objects from the Powershell pipeline.
Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Reject the 2's from a stream
@(1,2,3) | Search-Reject { param($it) $it -eq 2 }
1
3
-------------------------- EXAMPLE 2 --------------------------
PS C:\\># Reject out the 2's from a list
Search-Reject { param($it) $it -eq 2 } -InputObject @(1,2,3)
1
3
RELATED LINKS
SYNOPSIS
Perform functional-style filter-to-reject operations on a sequence or stream of objects in a Powershell pipeline
SYNTAX
Search-Reject [-Expression] <ScriptBlock> [-InputObject] <Object[]> [<CommonParameters>]
DESCRIPTION
Apply the given ScriptBlock expression to each member of the pipelined InputObject, rejecting those for which the
expression is True.
PARAMETERS
-Expression <ScriptBlock>
The anonymous (in-place) or named (as variable) single-argument lambda function to be applied to each
InputObject element. This must have a single-argument parameter block.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InputObject <Object[]>
The sequence or stream of Objects from the Powershell pipeline.
Required? true
Position? 2
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\># Reject the 2's from a stream
@(1,2,3) | Search-Reject { param($it) $it -eq 2 }
1
3
-------------------------- EXAMPLE 2 --------------------------
PS C:\\># Reject out the 2's from a list
Search-Reject { param($it) $it -eq 2 } -InputObject @(1,2,3)
1
3
RELATED LINKS