Powershell for text manipulation.

Powershell is extremely useful for text manipulation in limited Windows environments, due to its access to .NET classes. Following is the beginning of a page of one liners for manipulation of content in PS.

Get-Content myfile.txt | %{ ([regex] "some\s+regex").Matches($_)|%{$_.value} }

The above template creates a regex object, Matches each line of content against the pattern, and feeds it back to $_.value to extract the text.

The |%{} loop and abstraction via bracketing really compose the major grammatical structure of PSh one liners.

[More to come, stay tuned]