LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 07-23-2013, 04:22 PM   #1
dmesserly
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, 04:40 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux, LFS, Slitaz
Posts: 3,096
Blog Entries: 1

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

Code:
ls -1v
or numbers in a file:

Code:
sort -g filename

Last edited by szboardstretcher; 07-23-2013 at 04:42 PM.
 
1 members found this post helpful.
Old 07-23-2013, 05:02 PM   #3
dmesserly
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.
 
  


Reply

Tags
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 02:56 PM
Can I use GNU sort to sort one field in order, another in reverse? zombieite Linux - Newbie 4 04-27-2009 12:23 AM
How do I do filtering in Perl (keep sort order and sort again by another means)? RavenLX Programming 9 12-19-2008 10:12 AM
Suggestion: Let's sort them in a,b,c... order fuelinux LQ Suggestions & Feedback 8 01-20-2008 10:35 AM
Sort order in nautilus Patrick K Ubuntu 4 06-12-2007 08:53 PM


All times are GMT -5. The time now is 11:40 PM.

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