How do I sort lines in numeric order in Notepad++?












3














Using Notepad++ v6.6.8 with TextFX.



How do I sort lines in numeric order rather than alphanumeric?



That is I want lines to sort like:



1
2
10
11
15
20


not:



1
10
11
15
2
20









share|improve this question
























  • I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
    – krowe
    Sep 8 '14 at 0:18










  • @krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
    – User
    Sep 8 '14 at 0:25












  • I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
    – krowe
    Sep 8 '14 at 1:04










  • @krowe This feature using not numeric order.
    – crazypotato
    Sep 9 '14 at 19:08












  • @crazypotato Check below, I've already suggested a plugin which does.
    – krowe
    Sep 9 '14 at 21:15


















3














Using Notepad++ v6.6.8 with TextFX.



How do I sort lines in numeric order rather than alphanumeric?



That is I want lines to sort like:



1
2
10
11
15
20


not:



1
10
11
15
2
20









share|improve this question
























  • I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
    – krowe
    Sep 8 '14 at 0:18










  • @krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
    – User
    Sep 8 '14 at 0:25












  • I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
    – krowe
    Sep 8 '14 at 1:04










  • @krowe This feature using not numeric order.
    – crazypotato
    Sep 9 '14 at 19:08












  • @crazypotato Check below, I've already suggested a plugin which does.
    – krowe
    Sep 9 '14 at 21:15
















3












3








3


1





Using Notepad++ v6.6.8 with TextFX.



How do I sort lines in numeric order rather than alphanumeric?



That is I want lines to sort like:



1
2
10
11
15
20


not:



1
10
11
15
2
20









share|improve this question















Using Notepad++ v6.6.8 with TextFX.



How do I sort lines in numeric order rather than alphanumeric?



That is I want lines to sort like:



1
2
10
11
15
20


not:



1
10
11
15
2
20






notepad++






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 8 '14 at 1:11

























asked Sep 8 '14 at 0:10









User

1,74542237




1,74542237












  • I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
    – krowe
    Sep 8 '14 at 0:18










  • @krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
    – User
    Sep 8 '14 at 0:25












  • I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
    – krowe
    Sep 8 '14 at 1:04










  • @krowe This feature using not numeric order.
    – crazypotato
    Sep 9 '14 at 19:08












  • @crazypotato Check below, I've already suggested a plugin which does.
    – krowe
    Sep 9 '14 at 21:15




















  • I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
    – krowe
    Sep 8 '14 at 0:18










  • @krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
    – User
    Sep 8 '14 at 0:25












  • I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
    – krowe
    Sep 8 '14 at 1:04










  • @krowe This feature using not numeric order.
    – crazypotato
    Sep 9 '14 at 19:08












  • @crazypotato Check below, I've already suggested a plugin which does.
    – krowe
    Sep 9 '14 at 21:15


















I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
– krowe
Sep 8 '14 at 0:18




I'm pretty sure it doesn't do either without a plugin. Are you using TextFX?
– krowe
Sep 8 '14 at 0:18












@krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
– User
Sep 8 '14 at 0:25






@krowe yes I have TextFX and I'm using TextFx->TextFX Tools->Sort lines case insensitive (at column)
– User
Sep 8 '14 at 0:25














I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
– krowe
Sep 8 '14 at 1:04




I just noticed that my version is way out of date. Line sorting was added to 6.5.2 without a plugin according to the release notes: notepad-plus-plus.org/news/notepad-6.5.2-release.html
– krowe
Sep 8 '14 at 1:04












@krowe This feature using not numeric order.
– crazypotato
Sep 9 '14 at 19:08






@krowe This feature using not numeric order.
– crazypotato
Sep 9 '14 at 19:08














@crazypotato Check below, I've already suggested a plugin which does.
– krowe
Sep 9 '14 at 21:15






@crazypotato Check below, I've already suggested a plugin which does.
– krowe
Sep 9 '14 at 21:15












5 Answers
5






active

oldest

votes


















5














I don't know what your file looks like, but I'd use regular expressions to add spaces or zeros before each number to make them the same length (e.g. 2 becomes 002). Then they will sort correctly and you can use another replacement to strip the leading spaces/zeros afterwards.



These are the steps (works for number up to 10 characters)



Find: ^
Replace: 0000000000



Find: d*(d{10})
Replace: 1



Sort



Find: ^0*
Replace:



It works by adding 10 zeros before the number, even though that's probably too much. The second replacement than takes the last 10 digits of the number to bring everything back to the same length, giving you numbers like 0000000839, 0000000003 etc. Those will sort in the order you want them to sort. Once sorted the last expression will strip all leading zeros so you'll have your original numbers back.



If you need longer numbers just add more zeros to the first replacement, and increase the 10 in the second replacement accordingly. If you're going to do this more often you could record a macro with these steps.






share|improve this answer



















  • 1




    This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
    – crazypotato
    Sep 8 '14 at 1:22










  • Fur such simple things tool should make it in one step. If need more steps then better use another tool.
    – crazypotato
    Sep 8 '14 at 1:36










  • I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
    – AVee
    Sep 8 '14 at 7:12










  • So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
    – crazypotato
    Sep 8 '14 at 13:28










  • I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
    – AVee
    Sep 8 '14 at 18:28



















1














I haven't tried this but there is a plugin which claims to do this (as long as the lines BEGIN with a number). Here is the link: http://www.scout-soft.com/linesort/



Update
Ok, that plugin is apparently gone for now. Maybe it doesn't work with newer NP++ versions. Here is another one which I've seen in the plugin manager so it is at least more common: http://william.famille-blum.org/blog/index.php?entry=entry110123-113226



I just tried it on 6.6.9 and it is a little awkward (don't forget to hit the Add button on the dialog) but works perfectly well.






share|improve this answer























  • I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
    – User
    Sep 8 '14 at 0:42










  • Actually turns out I don't think the dll is even downloadable I get a 404
    – User
    Sep 8 '14 at 0:53










  • @User See my update.
    – krowe
    Sep 8 '14 at 1:13



















1














Select all and copy as text to Excel or other spreadsheet program, use custom sort. Each line should paste as a single cell, A1, B1, etc. Just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Paste back to notepad++.



In the more complex case that OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that space to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order. The exact formula to rip the line number will depend on the line format, but the above command should work with minor modification for most cases, otherwise stack exchange has further examples of similar formulas.






share|improve this answer



















  • 1




    Isn't text going to create the problem described in the question?
    – fixer1234
    Aug 31 '16 at 18:31










  • No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
    – J Vook
    Sep 2 '16 at 3:41






  • 1




    Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
    – J Vook
    Sep 4 '16 at 14:34



















1














This is now easy to achieve (at least in Notepad++ 7.5.9):



Use the menu item:
Edit -> Line Operations -> Sort Lines As Integers Ascending



(Note if you don't select any text it will sort the entire file, and if you select text it constrains the sorting to the selected text.)






share|improve this answer





















  • You should mark this as accepted.
    – Toto
    Dec 6 at 13:33



















-2














Column sorting plugin



http://william.famille-blum.org/software/nppcolumnsort/NppColumnSort-1.0.0.2.zip



You have to specify the starting column for numbers (usually 1, the first one) and the lenght to compare (maximum number of digits). Then set sort order "Ascending" and comparison type "Numeric".






share|improve this answer





















  • Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
    – Francisco Tapia
    Sep 4 '15 at 14:30











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f808574%2fhow-do-i-sort-lines-in-numeric-order-in-notepad%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























5 Answers
5






active

oldest

votes








5 Answers
5






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














I don't know what your file looks like, but I'd use regular expressions to add spaces or zeros before each number to make them the same length (e.g. 2 becomes 002). Then they will sort correctly and you can use another replacement to strip the leading spaces/zeros afterwards.



These are the steps (works for number up to 10 characters)



Find: ^
Replace: 0000000000



Find: d*(d{10})
Replace: 1



Sort



Find: ^0*
Replace:



It works by adding 10 zeros before the number, even though that's probably too much. The second replacement than takes the last 10 digits of the number to bring everything back to the same length, giving you numbers like 0000000839, 0000000003 etc. Those will sort in the order you want them to sort. Once sorted the last expression will strip all leading zeros so you'll have your original numbers back.



If you need longer numbers just add more zeros to the first replacement, and increase the 10 in the second replacement accordingly. If you're going to do this more often you could record a macro with these steps.






share|improve this answer



















  • 1




    This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
    – crazypotato
    Sep 8 '14 at 1:22










  • Fur such simple things tool should make it in one step. If need more steps then better use another tool.
    – crazypotato
    Sep 8 '14 at 1:36










  • I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
    – AVee
    Sep 8 '14 at 7:12










  • So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
    – crazypotato
    Sep 8 '14 at 13:28










  • I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
    – AVee
    Sep 8 '14 at 18:28
















5














I don't know what your file looks like, but I'd use regular expressions to add spaces or zeros before each number to make them the same length (e.g. 2 becomes 002). Then they will sort correctly and you can use another replacement to strip the leading spaces/zeros afterwards.



These are the steps (works for number up to 10 characters)



Find: ^
Replace: 0000000000



Find: d*(d{10})
Replace: 1



Sort



Find: ^0*
Replace:



It works by adding 10 zeros before the number, even though that's probably too much. The second replacement than takes the last 10 digits of the number to bring everything back to the same length, giving you numbers like 0000000839, 0000000003 etc. Those will sort in the order you want them to sort. Once sorted the last expression will strip all leading zeros so you'll have your original numbers back.



If you need longer numbers just add more zeros to the first replacement, and increase the 10 in the second replacement accordingly. If you're going to do this more often you could record a macro with these steps.






share|improve this answer



















  • 1




    This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
    – crazypotato
    Sep 8 '14 at 1:22










  • Fur such simple things tool should make it in one step. If need more steps then better use another tool.
    – crazypotato
    Sep 8 '14 at 1:36










  • I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
    – AVee
    Sep 8 '14 at 7:12










  • So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
    – crazypotato
    Sep 8 '14 at 13:28










  • I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
    – AVee
    Sep 8 '14 at 18:28














5












5








5






I don't know what your file looks like, but I'd use regular expressions to add spaces or zeros before each number to make them the same length (e.g. 2 becomes 002). Then they will sort correctly and you can use another replacement to strip the leading spaces/zeros afterwards.



These are the steps (works for number up to 10 characters)



Find: ^
Replace: 0000000000



Find: d*(d{10})
Replace: 1



Sort



Find: ^0*
Replace:



It works by adding 10 zeros before the number, even though that's probably too much. The second replacement than takes the last 10 digits of the number to bring everything back to the same length, giving you numbers like 0000000839, 0000000003 etc. Those will sort in the order you want them to sort. Once sorted the last expression will strip all leading zeros so you'll have your original numbers back.



If you need longer numbers just add more zeros to the first replacement, and increase the 10 in the second replacement accordingly. If you're going to do this more often you could record a macro with these steps.






share|improve this answer














I don't know what your file looks like, but I'd use regular expressions to add spaces or zeros before each number to make them the same length (e.g. 2 becomes 002). Then they will sort correctly and you can use another replacement to strip the leading spaces/zeros afterwards.



These are the steps (works for number up to 10 characters)



Find: ^
Replace: 0000000000



Find: d*(d{10})
Replace: 1



Sort



Find: ^0*
Replace:



It works by adding 10 zeros before the number, even though that's probably too much. The second replacement than takes the last 10 digits of the number to bring everything back to the same length, giving you numbers like 0000000839, 0000000003 etc. Those will sort in the order you want them to sort. Once sorted the last expression will strip all leading zeros so you'll have your original numbers back.



If you need longer numbers just add more zeros to the first replacement, and increase the 10 in the second replacement accordingly. If you're going to do this more often you could record a macro with these steps.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 8 '14 at 18:25

























answered Sep 8 '14 at 0:31









AVee

1764




1764








  • 1




    This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
    – crazypotato
    Sep 8 '14 at 1:22










  • Fur such simple things tool should make it in one step. If need more steps then better use another tool.
    – crazypotato
    Sep 8 '14 at 1:36










  • I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
    – AVee
    Sep 8 '14 at 7:12










  • So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
    – crazypotato
    Sep 8 '14 at 13:28










  • I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
    – AVee
    Sep 8 '14 at 18:28














  • 1




    This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
    – crazypotato
    Sep 8 '14 at 1:22










  • Fur such simple things tool should make it in one step. If need more steps then better use another tool.
    – crazypotato
    Sep 8 '14 at 1:36










  • I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
    – AVee
    Sep 8 '14 at 7:12










  • So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
    – crazypotato
    Sep 8 '14 at 13:28










  • I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
    – AVee
    Sep 8 '14 at 18:28








1




1




This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
– crazypotato
Sep 8 '14 at 1:22




This is painful. More easy use sort from UnxUpdates.zip sort -n in.txt>out.txt
– crazypotato
Sep 8 '14 at 1:22












Fur such simple things tool should make it in one step. If need more steps then better use another tool.
– crazypotato
Sep 8 '14 at 1:36




Fur such simple things tool should make it in one step. If need more steps then better use another tool.
– crazypotato
Sep 8 '14 at 1:36












I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
– AVee
Sep 8 '14 at 7:12




I agree with both of you, the question was specifically about notepad++ though. And recording it into a macro will make it a single step again.
– AVee
Sep 8 '14 at 7:12












So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
– crazypotato
Sep 8 '14 at 13:28




So where actual answer with steps? I will like to see it cause i not sure how i can make regex depend on length string.
– crazypotato
Sep 8 '14 at 13:28












I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
– AVee
Sep 8 '14 at 18:28




I've added the steps, personally I'd use sort -n but if this is part of a common workflow it might make sense to create a macro to do this so you won't have to leave Notepad++
– AVee
Sep 8 '14 at 18:28













1














I haven't tried this but there is a plugin which claims to do this (as long as the lines BEGIN with a number). Here is the link: http://www.scout-soft.com/linesort/



Update
Ok, that plugin is apparently gone for now. Maybe it doesn't work with newer NP++ versions. Here is another one which I've seen in the plugin manager so it is at least more common: http://william.famille-blum.org/blog/index.php?entry=entry110123-113226



I just tried it on 6.6.9 and it is a little awkward (don't forget to hit the Add button on the dialog) but works perfectly well.






share|improve this answer























  • I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
    – User
    Sep 8 '14 at 0:42










  • Actually turns out I don't think the dll is even downloadable I get a 404
    – User
    Sep 8 '14 at 0:53










  • @User See my update.
    – krowe
    Sep 8 '14 at 1:13
















1














I haven't tried this but there is a plugin which claims to do this (as long as the lines BEGIN with a number). Here is the link: http://www.scout-soft.com/linesort/



Update
Ok, that plugin is apparently gone for now. Maybe it doesn't work with newer NP++ versions. Here is another one which I've seen in the plugin manager so it is at least more common: http://william.famille-blum.org/blog/index.php?entry=entry110123-113226



I just tried it on 6.6.9 and it is a little awkward (don't forget to hit the Add button on the dialog) but works perfectly well.






share|improve this answer























  • I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
    – User
    Sep 8 '14 at 0:42










  • Actually turns out I don't think the dll is even downloadable I get a 404
    – User
    Sep 8 '14 at 0:53










  • @User See my update.
    – krowe
    Sep 8 '14 at 1:13














1












1








1






I haven't tried this but there is a plugin which claims to do this (as long as the lines BEGIN with a number). Here is the link: http://www.scout-soft.com/linesort/



Update
Ok, that plugin is apparently gone for now. Maybe it doesn't work with newer NP++ versions. Here is another one which I've seen in the plugin manager so it is at least more common: http://william.famille-blum.org/blog/index.php?entry=entry110123-113226



I just tried it on 6.6.9 and it is a little awkward (don't forget to hit the Add button on the dialog) but works perfectly well.






share|improve this answer














I haven't tried this but there is a plugin which claims to do this (as long as the lines BEGIN with a number). Here is the link: http://www.scout-soft.com/linesort/



Update
Ok, that plugin is apparently gone for now. Maybe it doesn't work with newer NP++ versions. Here is another one which I've seen in the plugin manager so it is at least more common: http://william.famille-blum.org/blog/index.php?entry=entry110123-113226



I just tried it on 6.6.9 and it is a little awkward (don't forget to hit the Add button on the dialog) but works perfectly well.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 8 '14 at 1:20

























answered Sep 8 '14 at 0:38









krowe

4,83111428




4,83111428












  • I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
    – User
    Sep 8 '14 at 0:42










  • Actually turns out I don't think the dll is even downloadable I get a 404
    – User
    Sep 8 '14 at 0:53










  • @User See my update.
    – krowe
    Sep 8 '14 at 1:13


















  • I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
    – User
    Sep 8 '14 at 0:42










  • Actually turns out I don't think the dll is even downloadable I get a 404
    – User
    Sep 8 '14 at 0:53










  • @User See my update.
    – krowe
    Sep 8 '14 at 1:13
















I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
– User
Sep 8 '14 at 0:42




I saw that; ultimately I may try it although I'd prefer to use a vetted solution. Installing random dll's that don't have a large consenus use is not my ideal
– User
Sep 8 '14 at 0:42












Actually turns out I don't think the dll is even downloadable I get a 404
– User
Sep 8 '14 at 0:53




Actually turns out I don't think the dll is even downloadable I get a 404
– User
Sep 8 '14 at 0:53












@User See my update.
– krowe
Sep 8 '14 at 1:13




@User See my update.
– krowe
Sep 8 '14 at 1:13











1














Select all and copy as text to Excel or other spreadsheet program, use custom sort. Each line should paste as a single cell, A1, B1, etc. Just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Paste back to notepad++.



In the more complex case that OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that space to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order. The exact formula to rip the line number will depend on the line format, but the above command should work with minor modification for most cases, otherwise stack exchange has further examples of similar formulas.






share|improve this answer



















  • 1




    Isn't text going to create the problem described in the question?
    – fixer1234
    Aug 31 '16 at 18:31










  • No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
    – J Vook
    Sep 2 '16 at 3:41






  • 1




    Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
    – J Vook
    Sep 4 '16 at 14:34
















1














Select all and copy as text to Excel or other spreadsheet program, use custom sort. Each line should paste as a single cell, A1, B1, etc. Just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Paste back to notepad++.



In the more complex case that OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that space to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order. The exact formula to rip the line number will depend on the line format, but the above command should work with minor modification for most cases, otherwise stack exchange has further examples of similar formulas.






share|improve this answer



















  • 1




    Isn't text going to create the problem described in the question?
    – fixer1234
    Aug 31 '16 at 18:31










  • No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
    – J Vook
    Sep 2 '16 at 3:41






  • 1




    Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
    – J Vook
    Sep 4 '16 at 14:34














1












1








1






Select all and copy as text to Excel or other spreadsheet program, use custom sort. Each line should paste as a single cell, A1, B1, etc. Just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Paste back to notepad++.



In the more complex case that OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that space to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order. The exact formula to rip the line number will depend on the line format, but the above command should work with minor modification for most cases, otherwise stack exchange has further examples of similar formulas.






share|improve this answer














Select all and copy as text to Excel or other spreadsheet program, use custom sort. Each line should paste as a single cell, A1, B1, etc. Just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Paste back to notepad++.



In the more complex case that OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that space to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order. The exact formula to rip the line number will depend on the line format, but the above command should work with minor modification for most cases, otherwise stack exchange has further examples of similar formulas.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 4 '16 at 14:38

























answered Aug 31 '16 at 16:56









J Vook

113




113








  • 1




    Isn't text going to create the problem described in the question?
    – fixer1234
    Aug 31 '16 at 18:31










  • No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
    – J Vook
    Sep 2 '16 at 3:41






  • 1




    Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
    – J Vook
    Sep 4 '16 at 14:34














  • 1




    Isn't text going to create the problem described in the question?
    – fixer1234
    Aug 31 '16 at 18:31










  • No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
    – J Vook
    Sep 2 '16 at 3:41






  • 1




    Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
    – J Vook
    Sep 4 '16 at 14:34








1




1




Isn't text going to create the problem described in the question?
– fixer1234
Aug 31 '16 at 18:31




Isn't text going to create the problem described in the question?
– fixer1234
Aug 31 '16 at 18:31












No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
– J Vook
Sep 2 '16 at 3:41




No, just need to set the field as numeral not text. This is done by setting cell format, or using TEXT function. Assuming OP has text mixed with numbers (e.g., "1 First line," "12 Twelfth line"), we can create a sort column to organize the list. Since there is a space after the number, we can find that to create a column with just the numbers using =LEFT(A1,FIND(" ",A1,1)). After spreading the function to the whole column, we can sort both columns based on the sort column order (i.e., numeric order) and then copy the first column back in the right order.
– J Vook
Sep 2 '16 at 3:41




1




1




Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
– J Vook
Sep 4 '16 at 14:34




Yeah I thought so too in my original reply but then I realized OP was asking for sorting whole lines, not just the numbers.
– J Vook
Sep 4 '16 at 14:34











1














This is now easy to achieve (at least in Notepad++ 7.5.9):



Use the menu item:
Edit -> Line Operations -> Sort Lines As Integers Ascending



(Note if you don't select any text it will sort the entire file, and if you select text it constrains the sorting to the selected text.)






share|improve this answer





















  • You should mark this as accepted.
    – Toto
    Dec 6 at 13:33
















1














This is now easy to achieve (at least in Notepad++ 7.5.9):



Use the menu item:
Edit -> Line Operations -> Sort Lines As Integers Ascending



(Note if you don't select any text it will sort the entire file, and if you select text it constrains the sorting to the selected text.)






share|improve this answer





















  • You should mark this as accepted.
    – Toto
    Dec 6 at 13:33














1












1








1






This is now easy to achieve (at least in Notepad++ 7.5.9):



Use the menu item:
Edit -> Line Operations -> Sort Lines As Integers Ascending



(Note if you don't select any text it will sort the entire file, and if you select text it constrains the sorting to the selected text.)






share|improve this answer












This is now easy to achieve (at least in Notepad++ 7.5.9):



Use the menu item:
Edit -> Line Operations -> Sort Lines As Integers Ascending



(Note if you don't select any text it will sort the entire file, and if you select text it constrains the sorting to the selected text.)







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 6 at 0:26









User

1,74542237




1,74542237












  • You should mark this as accepted.
    – Toto
    Dec 6 at 13:33


















  • You should mark this as accepted.
    – Toto
    Dec 6 at 13:33
















You should mark this as accepted.
– Toto
Dec 6 at 13:33




You should mark this as accepted.
– Toto
Dec 6 at 13:33











-2














Column sorting plugin



http://william.famille-blum.org/software/nppcolumnsort/NppColumnSort-1.0.0.2.zip



You have to specify the starting column for numbers (usually 1, the first one) and the lenght to compare (maximum number of digits). Then set sort order "Ascending" and comparison type "Numeric".






share|improve this answer





















  • Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
    – Francisco Tapia
    Sep 4 '15 at 14:30
















-2














Column sorting plugin



http://william.famille-blum.org/software/nppcolumnsort/NppColumnSort-1.0.0.2.zip



You have to specify the starting column for numbers (usually 1, the first one) and the lenght to compare (maximum number of digits). Then set sort order "Ascending" and comparison type "Numeric".






share|improve this answer





















  • Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
    – Francisco Tapia
    Sep 4 '15 at 14:30














-2












-2








-2






Column sorting plugin



http://william.famille-blum.org/software/nppcolumnsort/NppColumnSort-1.0.0.2.zip



You have to specify the starting column for numbers (usually 1, the first one) and the lenght to compare (maximum number of digits). Then set sort order "Ascending" and comparison type "Numeric".






share|improve this answer












Column sorting plugin



http://william.famille-blum.org/software/nppcolumnsort/NppColumnSort-1.0.0.2.zip



You have to specify the starting column for numbers (usually 1, the first one) and the lenght to compare (maximum number of digits). Then set sort order "Ascending" and comparison type "Numeric".







share|improve this answer












share|improve this answer



share|improve this answer










answered Sep 4 '15 at 13:26









user3177026

1




1












  • Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
    – Francisco Tapia
    Sep 4 '15 at 14:30


















  • Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
    – Francisco Tapia
    Sep 4 '15 at 14:30
















Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
– Francisco Tapia
Sep 4 '15 at 14:30




Welcome to SU, instead to point to a .zip file to download you could quote the relevant information from that site and provide a link with reference to the quoted text.
– Francisco Tapia
Sep 4 '15 at 14:30


















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • 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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f808574%2fhow-do-i-sort-lines-in-numeric-order-in-notepad%23new-answer', 'question_page');
}
);

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







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?