January 26, 2011
How to remove line 2 in a txt-file and add a last line so it always is 25 lines including the header (first line)?

$txt = Get-Content C:\script\Powershell\hourly_temp.txt | select -First 1 -Last 23
$txt = $txt + ($hour + "," + $k1 + "," + $k2 + "," + $ups)                      
$txt | Out-File C:\script\Powershell\hourly_temp.txt -force -encoding ASCII