The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to sort alphabetically after finding values doubleminus UNIX for Dummies Questions & Answers 4 04-28-2008 06:45 AM
Sort a file line by line alphabetically H2OBoodle Shell Programming and Scripting 11 02-11-2008 07:27 AM
sort csv file mozart Shell Programming and Scripting 6 02-11-2008 03:49 AM
how to sort the file in specified folder maximas Shell Programming and Scripting 0 10-07-2007 04:16 AM
how to sort a file tao UNIX for Dummies Questions & Answers 2 03-24-2002 11:34 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2008
mrodrig mrodrig is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
Exclamation Sort file alphabetically AND numerically

Hi all.
I have 2 files like this:

f1
A 10
B 80
C 9

f2
A 11
B 700
C 10

What I want is the concatenation of the two files sorted by name (alphabetically) and size (numerically), so the result should be like this:

F3 (cat f1 f2 sorted)
A 10
A 11
B 80
B 700
C 9
C 10

but the result I get when I do sort f1 f2 is:

A 10
A 11
B 700
B 80
C 10
C 9

Thanks for your help.
  #2 (permalink)  
Old 05-16-2008
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
Try:
sort -k 1,1 -k 2,2n f1 f2
  #3 (permalink)  
Old 05-19-2008
mrodrig mrodrig is offline
Registered User
  
 

Join Date: May 2008
Posts: 12
Thumbs up Tks

Thanks a lot, it worked!!
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:34 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0