在PowerShell中,已排序文件的大小是原始文件的两倍

Yau*_*mal 7 sorting powershell powershell-2.0 powershell-1.0 powershell-3.0

我有一个powershell脚本,它读取文件内容,对其进行排序并将输出写入新文件.以下是脚本:

get-content $ inputFile | sort> $ sortedFile

文件中的输出正确排序,但输出文件($ sortedFile)比输入文件($ inputFile)大两倍.注意:输出文件中没有重复或额外的行.

任何关于此的帮助或想法都会有所帮助.

Lie*_*ers 10

输入文件很可能是ascii编码,而使用重定向的默认输出是unicode编码.

>您可以使用out-file并指定编码,而不是使用重定向.

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