Здесь, как никогда, хорош будет PowerShell:
Код:

$sSourceFile = "C:\Песочница\022\0001.txt"
$sDestFile = "C:\Песочница\022\0002.txt"
if(Test-Path -Path $sSourceFile) {
Get-Content -Path $sSourceFile |`
ForEach-Object -Process {
($_.Split(",") |`
ForEach-Object -Process {
[System.Int32]$_.Trim()
} | Sort-Object) -join ", "
} | Set-Content -Path $sDestFile
} else {
Write-Host -ForegroundColor Red "Can't find source file [$sSourceFile]"
}