|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Homework & Coursework Questions Students must use and complete the template provided. If you don't, your post may be deleted! Special homework rules apply here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
Linux Sort Command
Hey Don I think your right. I used that solution first but I felt it was too trivial initially. Now thinking about it again, I definitely think I read into the question a bit much. Thank you for your help. @bartus11 I will definitely try your script again and or use it for further reference. Thanks a lot.
|
|
#9
|
|||
|
|||
|
There are some "sort" intrinsics to be considered and i think you haven't covered them all yet. This might not have any impact on your test file, but may well change the sorting order in another sample. Lets see: The default behavior of "sort" is to sort from the field/position given in te argument to the "-k" option to the end of line. That means: Code:
sort -k 2 /some/file will sort on field 2 first, in case f2 is equal on field 3, if this is equal too on field 4, etc. to the end of line. As you want to search on a last name - first name basis you have to state that: Code:
sort -k 2,2 -k 1,1 You are lucky that you use only full fields, because it is possible to base sorting order on a sub-field starting at the n-th character of a certain field. Alas, character-numbering is sometimes 1-based and sometimes zero-based, depending on "-t" or "-b" being used - as i learned myself recently the hard way. I hope this helps. bakunin |
|
#10
|
|||
|
|||
|
Quote:
|
|
#11
|
|||
|
|||
|
Thanks everyone. I appreciate your help.
|
![]() |
| Tags |
| sort by column, sort field |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| LINUX SORT command chops results | Yahalom | UNIX for Dummies Questions & Answers | 4 | 04-04-2012 09:44 AM |
| sort command in centos linux os | jpachar | Linux | 1 | 02-22-2012 04:52 AM |
| linux sort command produces strange output | ajb | UNIX for Dummies Questions & Answers | 3 | 08-11-2011 12:17 PM |
| How to Sort Floating Numbers Using the Sort Command? | daniel.gbaena | Shell Programming and Scripting | 7 | 05-16-2010 11:20 AM |
| Linux Sort command | itisijayare | UNIX for Dummies Questions & Answers | 1 | 04-03-2009 02:05 PM |
|
|