sort -n doesn't work?
I am doing a usual thing that I sort -n
but this time it does not work for the following input list, partially like
./firedock-output_308.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 54.06
./firedock-output_286.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.91
./firedock-output_26.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.86
./firedock-output_7.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 24.29
./firedock-output_843.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.88
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
and the output after sort -k1,1n
is
./firedock-output_1000.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 95.86
./firedock-output_100.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_101.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 33.89
./firedock-output_102.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.83
./firedock-output_103.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.69
./firedock-output_104.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 69.43
./firedock-output_105.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 25.11
./firedock-output_106.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.46
./firedock-output_107.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 41.77
./firedock-output_108.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.61
./firedock-output_109.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 72.75
./firedock-output_10.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 67.79
./firedock-output_110.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 13.87
./firedock-output_111.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.44
./firedock-output_112.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 27.03
./firedock-output_113.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 37.43
./firedock-output_114.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.57
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
./firedock-output_116.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 57.75
./firedock-output_117.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 21.21
Why sort -n
does not work as it normally does (i.e. sort according to numerical order) for this case?
What I want is
./firedock-output_1.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_2.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_3.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_4.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
until 1000 (totally there are 1000 lines).
Thanks.
sort
add a comment |
I am doing a usual thing that I sort -n
but this time it does not work for the following input list, partially like
./firedock-output_308.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 54.06
./firedock-output_286.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.91
./firedock-output_26.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.86
./firedock-output_7.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 24.29
./firedock-output_843.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.88
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
and the output after sort -k1,1n
is
./firedock-output_1000.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 95.86
./firedock-output_100.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_101.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 33.89
./firedock-output_102.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.83
./firedock-output_103.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.69
./firedock-output_104.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 69.43
./firedock-output_105.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 25.11
./firedock-output_106.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.46
./firedock-output_107.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 41.77
./firedock-output_108.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.61
./firedock-output_109.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 72.75
./firedock-output_10.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 67.79
./firedock-output_110.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 13.87
./firedock-output_111.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.44
./firedock-output_112.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 27.03
./firedock-output_113.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 37.43
./firedock-output_114.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.57
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
./firedock-output_116.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 57.75
./firedock-output_117.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 21.21
Why sort -n
does not work as it normally does (i.e. sort according to numerical order) for this case?
What I want is
./firedock-output_1.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_2.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_3.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_4.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
until 1000 (totally there are 1000 lines).
Thanks.
sort
add a comment |
I am doing a usual thing that I sort -n
but this time it does not work for the following input list, partially like
./firedock-output_308.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 54.06
./firedock-output_286.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.91
./firedock-output_26.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.86
./firedock-output_7.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 24.29
./firedock-output_843.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.88
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
and the output after sort -k1,1n
is
./firedock-output_1000.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 95.86
./firedock-output_100.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_101.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 33.89
./firedock-output_102.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.83
./firedock-output_103.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.69
./firedock-output_104.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 69.43
./firedock-output_105.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 25.11
./firedock-output_106.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.46
./firedock-output_107.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 41.77
./firedock-output_108.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.61
./firedock-output_109.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 72.75
./firedock-output_10.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 67.79
./firedock-output_110.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 13.87
./firedock-output_111.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.44
./firedock-output_112.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 27.03
./firedock-output_113.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 37.43
./firedock-output_114.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.57
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
./firedock-output_116.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 57.75
./firedock-output_117.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 21.21
Why sort -n
does not work as it normally does (i.e. sort according to numerical order) for this case?
What I want is
./firedock-output_1.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_2.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_3.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_4.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
until 1000 (totally there are 1000 lines).
Thanks.
sort
I am doing a usual thing that I sort -n
but this time it does not work for the following input list, partially like
./firedock-output_308.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 54.06
./firedock-output_286.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.91
./firedock-output_26.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.86
./firedock-output_7.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 24.29
./firedock-output_843.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.88
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
and the output after sort -k1,1n
is
./firedock-output_1000.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 95.86
./firedock-output_100.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_101.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 33.89
./firedock-output_102.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.83
./firedock-output_103.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 19.69
./firedock-output_104.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 69.43
./firedock-output_105.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 25.11
./firedock-output_106.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 17.46
./firedock-output_107.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 41.77
./firedock-output_108.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.61
./firedock-output_109.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 72.75
./firedock-output_10.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 67.79
./firedock-output_110.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 13.87
./firedock-output_111.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.44
./firedock-output_112.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 27.03
./firedock-output_113.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 37.43
./firedock-output_114.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 18.57
./firedock-output_115.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 142.42
./firedock-output_116.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 57.75
./firedock-output_117.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 21.21
Why sort -n
does not work as it normally does (i.e. sort according to numerical order) for this case?
What I want is
./firedock-output_1.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_2.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_3.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
./firedock-output_4.ref_clashscore_cat_elmo1-NT_rhog1_clashscore:clashscore = 12.62
until 1000 (totally there are 1000 lines).
Thanks.
sort
sort
asked 6 mins ago
Johnny TamJohnny Tam
122111
122111
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
OK, solved. I need to specify the position of sort key, which is the 19th character.
sort -n -k1.19
Thanks a lot!
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507871%2fsort-n-doesnt-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
OK, solved. I need to specify the position of sort key, which is the 19th character.
sort -n -k1.19
Thanks a lot!
add a comment |
OK, solved. I need to specify the position of sort key, which is the 19th character.
sort -n -k1.19
Thanks a lot!
add a comment |
OK, solved. I need to specify the position of sort key, which is the 19th character.
sort -n -k1.19
Thanks a lot!
OK, solved. I need to specify the position of sort key, which is the 19th character.
sort -n -k1.19
Thanks a lot!
answered 14 secs ago
Johnny TamJohnny Tam
122111
122111
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f507871%2fsort-n-doesnt-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown