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.


The Unix “tac” command will allow you to see a file line-by-line backwards.  It will print each record in reverse order.  Records are separated by instances of a string (newline being the default).  The “-s” option allows you to change the newline to be any other string you want to use such as a comma or space.

The code will iterate through the specified files and, for each file, Get-Content will be called, the returned array reversed, and then printed to the console.  For non-newline separators I had to add in join to the target array to account for the extra newlines that would be added if the $tokens array was displayed directly to the console.