andieje
asked on
sort not working as expected
Hi
I have a data file which has data of this form in column1
xxx1
xxx23
xxx15
I want to sort numerically on the numbers after the 3 x's so i tried this command
sort -nk1.3
but xxx10 is coming before xxx1
thanks
I have a data file which has data of this form in column1
xxx1
xxx23
xxx15
I want to sort numerically on the numbers after the 3 x's so i tried this command
sort -nk1.3
but xxx10 is coming before xxx1
thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i guess the easiest thing would be to separate the data into 2 files, sort them and then merge again
ASKER
thanks - it wasn't working because it turns out there are some characters instead of numbers
when sort encounters a character in a numerical sort it puts the characters first. is there any way to get the characters at the end? e.g. sort numerically if a number and sort alphabetically if a letter and put the numbers before the letters