I am using
gc FileWithEmptyLines.txt | where {$_ -ne \"\"} > FileWithNoEmptyLines.txt
to remove the empty lines that SSRS puts at the b
For 'UCS-2 Little Endian' file format, use this:
$stream = [IO.File]::Open($filename, [IO.FileMode]::Open)
$stream.Position = $stream.Length - 4
$bytes = 0..3 | %{ $stream.ReadByte() }
$compareBytes = 13,0,10,0 # CR,LF
echo "bytes: "$bytes
if ("$bytes" -eq "$compareBytes")
{
$stream.SetLength($stream.Length - 4)
}
$stream.Close()
$stream.Dispose()