I need to define an alias for this:
Select-String -NotMatch -Pattern "^[\t ]+\d"
so that I can use the alias instead of writing that long string each time.
After googling for 5 minutes and doing some experiments I came up with this:
filter foo {
$_ | Select-String -NotMatch -Pattern "^[\t ]+\d"
}
So now my script looks like this:
command1 | foo
command2 | foo
command3 | foo
command4 | foo
This is apparently working as expected, but I'm concerned about the efficiency implications of doing this.
Is the foo
filter acting as a transparent alias of the longer command line, or is it creating an entire new pipe or buffer or something?