Самое короткое решение, использующее perl oneliner:
perl -ne 'print join(",", sort { $a <=> $b } split(/,|\n/))."\n"' text.txt