Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-23-2013, 05:22 PM   #1
LQ Newbie
Registered: Apr 2013
Posts: 6

Rep: Reputation: Disabled
Number sort order

I want my numeric sort to turn out 1 2 10 20 instead of 1 10 2 20. How can this be done?
Old 07-23-2013, 05:40 PM   #2
Senior Member
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,504
Blog Entries: 1

Rep: Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179Reputation: 1179
well... if this is filenames that we are talking about:

ls -1v
or numbers in a file:

sort -g filename

Last edited by szboardstretcher; 07-23-2013 at 05:42 PM.
1 members found this post helpful.
Old 07-23-2013, 06:02 PM   #3
LQ Newbie
Registered: Apr 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you very much. So for Linux/Unix the "sort -g" will work on the data. Do you know a way to do this in the world of Microsoft - more specifically Access? If not that's cool, cause I can export the data and do a Linux sort on it.


number, numeric, order, sort

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing The Sort Order In Nautilus gacl Ubuntu 10 02-21-2011 03:56 PM
Can I use GNU sort to sort one field in order, another in reverse? zombieite Linux - Newbie 4 04-27-2009 01:23 AM
How do I do filtering in Perl (keep sort order and sort again by another means)? RavenLX Programming 9 12-19-2008 11:12 AM
Suggestion: Let's sort them in a,b,c... order fuelinux LQ Suggestions & Feedback 8 01-20-2008 11:35 AM
Sort order in nautilus Patrick K Ubuntu 4 06-12-2007 09:53 PM

All times are GMT -5. The time now is 05:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration