Skip to content

Instantly share code, notes, and snippets.

@aleybe
Created May 26, 2021 01:52
Show Gist options
  • Save aleybe/f51219cc0f8143b5637f0c2700c3b790 to your computer and use it in GitHub Desktop.
Save aleybe/f51219cc0f8143b5637f0c2700c3b790 to your computer and use it in GitHub Desktop.
function Get-LsGrep {
[Alias("lgrep")]
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline)]
[System.Array]
$lsOutput,
# Parameter help description
[Parameter(Position=1)]
[System.String]
$greppable
)
begin {
[System.Collections.ArrayList]$dataArray = @()
}
process {
$dataArray.Add($lsOutput) >> $null
}
end {
$stringResult = ($dataArray | Out-String)
return $stringResult | %{$_.Split([System.Environment]::NewLine)} | sls $greppable
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment