I found that there is the bug in standard linux sort program (textutils rpm) version 2.0.11-7 which is included in redhat 7.1, then I update it to 2.0.14-2 but the problem still remain. Then I downgrade the rpm to textutils-2.0a-2, it solved the problem.
here is the sample data file:
nsync_pop
nsynclp
nsync_pop_
abcd
nsyncrulez
abc
abc_d
abc_
result after sorting with textutils rpm version 2.0.14-2 :
abc
abc_
abcd
abc_d
nsynclp
nsync_pop
nsync_pop_
nsyncrulez
only textutils-2.0a-2 can produce the correct result:
abc
abc_
abc_d
abcd
nsync_pop
nsync_pop_
nsynclp
nsyncrulez
Is it the bug in the latest textutils rpm or it is not a bug ?