concept -split operator in category powershell

appears as: -split operator, The -split operator
Windows PowerShell in Action, Third Edition

This is an excerpt from Manning's book Windows PowerShell in Action, Third Edition.

You start by using the Get-Content cmdlet to write the data into a pipeline. Each line of the file is sent to the ForEach-Object cmdlet to be processed. The first thing you do in the body of the ForEach-Object cmdlet is initialize a hashtable in $e to hold the result. You take each line stored in the $_ variable and apply the -split operator to it. This splits the string into an array at each space character in the string. (We cover the -split operator in detail later in this chapter.) Then you assign the split string to three elements of the hashtable: $e.level, $e.lower, and $e.upper.

The -split operator performs the opposite operation to -join: it splits strings into a collection of smaller strings. Again, this operator can be used in both binary and unary forms.