I have a file with multiple numbers separated by commas on each line:
1,13,2,5
1,3
2,3,24
1,13,2,6
This is just a small example file. In the real file, each line could have hundreds of numbers.
How can these be sorted numerically by field? The result should be:
1,3
1,13,2,5
1,13,2,6
2,3,24
I tried sort -n -t,
, but that compares lines as numbers, producing the wrong result.