PowerShell_unix PowerShell is definitely gaining momentum in the windows scripting world but I still hear folks wanting to rely on unix based tools to get their job done.  In this series of posts I’m going to look at converting some of the more popular Unix based tools to PowerShell.

wc

The Unix “wc” (word count) command will print the character, word, and newline counts for each file specified and a total line if more than one file is specified.  This command is useful for quickly scanning a directory for small and large files or to quickly look at a file and determine it’s relative size.  The Get-Content Cmdlet will return the number of characters in the full but not the number of lines and words.  The following script will emulate the behavior of the Unix “wc” command with a few changes in the way parameters are supplied.