I ran import-csv for a file, I had to read through the file, and separate the lines based on a date on each line of the CSV. I figure I should have just filtered it, and export-csv, but I went the route of setting variables for each column I needed to keep, and then separating out the date (I didn’t want the /’s in the date field). I then used Write-output “$Var1,$Var2,$Var3,$Var4” | write-outfile -path $outfile -append. In most text editors it wrote out the file normally, but the file size of all of the separated out was double the file size of the original file.
I investigated this issue and the total number of lines matched between all of the files, i then looked at the raw data of the file found that it was adding null characters to the file.
Any idea why it would decide to add characters that do not exist in the original file?
submitted by /u/lostmojo
[link] [comments]
The post Write-output | Out-File adding 0x00 hex character appeared first on How to Code .NET.