Size of the sorted file is double than original file in powershell Size of the sorted file is double than original file in powershell powershell powershell

Size of the sorted file is double than original file in powershell


Most likely the input file is ascii encoding while the default output using redirection is unicode encoding.

Instead of using > as redirection you can use out-file and specify an encoding.

get-content $inputFile | sort | out-file -encoding ASCII