RT
Suppose the file test.txt contains purely numerical data, with the following numbers:
25
1
9
385
87
195876
Using the command sort test.txt only gives the following result:
1
195876
25
385
87
9
That is, when sort is used for sorting, it first sorts by the first character. Then if we want to sort according to the usual numerical size, how should we handle it? The expected result should be as follows:
1
9
25
87
385
195876
[ Last edited by suntb on 2007-5-18 at 10:05 AM ]
Suppose the file test.txt contains purely numerical data, with the following numbers:
25
1
9
385
87
195876
Using the command sort test.txt only gives the following result:
1
195876
25
385
87
9
That is, when sort is used for sorting, it first sorts by the first character. Then if we want to sort according to the usual numerical size, how should we handle it? The expected result should be as follows:
1
9
25
87
385
195876
[ Last edited by suntb on 2007-5-18 at 10:05 AM ]
