The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Using sort command to get numeric ascending order wali4813 Linux 3 10-30-2009 05:03 PM
Question about sort specific column and print other column at the same time ! patrick87 Shell Programming and Scripting 3 10-07-2009 07:43 AM
Sort ascending and descending don_0110 UNIX for Dummies Questions & Answers 1 11-27-2008 03:59 PM
Sort Numbers in ascending orders Raynon Shell Programming and Scripting 7 01-19-2007 02:03 AM
Sort / ascending order gyik UNIX for Dummies Questions & Answers 1 03-05-2001 10:08 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
durden_tyler's Avatar
durden_tyler durden_tyler is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 553
Quote:
Originally Posted by new2ksh View Post
...
your code is
Code:
sort -k2,10 -k32,33

...
That isn't my code ! My code had 28, which you changed to 32 and expected it to work. Take a look at the series of responses above.

Quote:
...
i want to see the record in alphabetical order like below
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112

Can you please send me the right code both for the position 2:10 and 32:33
...
Since you haven't mentioned specifically, I shall assume that you want characters 2:10 sorted ascending and then characters 32:33 sorted ascending as well.


Code:
$
$ cat file1.dat
21111111110001343 000001004OLF-AA029100020091112
21111111110000060 000001004ODL-CH001000020091112
24444444440001416 000001045OLF-AA011800020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000111 000001039ODL-SP002000020091112
23333333330000060 000001039ODL-CH001000020091112
22222222220000780 000001013OLF-AA006500020091112
$
$ sort -k 1.2,1.10 -k 2.14,2.15 file1.dat
21111111110001343 000001004OLF-AA029100020091112
21111111110000060 000001004ODL-CH001000020091112
22222222220000780 000001013OLF-AA006500020091112
23333333330001695 000001039OLF-AA030600020091112
23333333330000060 000001039ODL-CH001000020091112
23333333330000111 000001039ODL-SP002000020091112
24444444440001416 000001045OLF-AA011800020091112
$
$

tyler_durden

Last edited by durden_tyler; 4 Weeks Ago at 11:41 AM..
Reply

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 05:57 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