Sort ascending and descending


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Sort ascending and descending
# 1  
Old 11-22-2007
Sort ascending and descending

How can I sort a file as follows ?

cols 1 - 10 ascending
cols 11 - 18 descending
cols 19 - 20 ascending

Thanks
# 2  
Old 11-27-2008
Quote:
Originally Posted by don_0110
How can I sort a file as follows ?

cols 1 - 10 ascending
cols 11 - 18 descending
cols 19 - 20 ascending

Thanks
sort +0 -10 +10r -18 +19 -20
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to sort list of directories in descending order in perl?

Hi, I have a problem . I have few directories like inpTDT_1, inpTDT_2, inpTDT_3 and so on inside HOME directory . In one of my perl script (which is in my HOME), the above directories like inpTDT_1, inpTDT_2, inpTDT_3 are sorting out in an order So I wanted to sort all the inpTDT_1, inpTDT_2,... (1 Reply)
Discussion started by: venkatesh
1 Replies

2. Shell Programming and Scripting

Sort date time in ascending order

Hi, i had a data block (coming from pipe from other codes) as: H YF_CO.dat 77164 11/17/2013 04:00:02 731374590.96 1 1 731374590.96 76586 77164 578 2988 Y H YF_CO.dat 77164 11/17/2013 04:00:07 731374590.96 1 4 731374590.96 76586 77164 578 2988 Y H YF_CO.dat 77178 ... (5 Replies)
Discussion started by: pr5439
5 Replies

3. Shell Programming and Scripting

Help with sort data based on descending order problem

Input file 9.99331e-13 8.98451e-65 9.98418e-34 7.98319e-08 365592 111669 74942.9 0 Desired output 365592 111669 74942.9 7.98319e-08 1.99331e-13 6.98418e-34 (2 Replies)
Discussion started by: perl_beginner
2 Replies

4. Shell Programming and Scripting

ascending and descending sort

Hi I have a problem with sort command : sort -nk 1.28,1.34 file | sort -nrk 1.27 file | sort -nk 1.22,1.25 file |sort -nk 1.13,1.21 file | sort -nk 1.9,1.12 file | sort -nk 1.1,1.8 file This is the input file 0000000100010000000200004090317003 0000000100010000000230001020592002... (3 Replies)
Discussion started by: Fafa
3 Replies

5. Programming

Sort ascending n strings in C

Hy guys. My English is not so good, sorry for any mistakes. I'm a bigginer in C, and I have a problem. I want to sort ascending n strings, but I can't read the strings. Here is what I've done so far: //sort ascending n strings #include <stdio.h> int main() { int n,i,j; char a; ... (8 Replies)
Discussion started by: 1/0
8 Replies

6. Linux

Using sort command to get numeric ascending order

HI everyone, I am trying to use the unix sort command to get a list of numbers sorted in ascending order but having trouble in getting it to work. An example of this issue would be when i am trying to sort the following three number each on a different line "1" , "2" and "116" the sort command... (3 Replies)
Discussion started by: wali4813
3 Replies

7. Shell Programming and Scripting

sorting(both Ascending & Descending) files based on multiple fields

Hi All, I am encountered with a problem while sorting a file based on multiple columns . I need to sort like: (field2,ascending) , (field3,ascending) ,(field8,descending) , (field7,ascending),(field13,ascending). So far i was sorting only in ascending order but here i need to use one... (1 Reply)
Discussion started by: apjneeraj
1 Replies

8. Shell Programming and Scripting

Ascending & Descending order numbers

Dear All, I have below attached file in which i have many nos, i want the last ascending order nos. The brief description is given below. File 315 381 432 315 381 432 315 381 432 315 381 432 315 381 432 (6 Replies)
Discussion started by: pravani1
6 Replies

9. Shell Programming and Scripting

Sort Descending

HI, i want to sort values in descending order and get the column no.s of the sorted value. my data will look like: subject 1 2 3 4 5 bob 78 45 89 99 54 i want the score to be sorted in descending and get the corresponding subject sorted in the output. Please help me with gawk or ??... (1 Reply)
Discussion started by: saint2006
1 Replies

10. UNIX for Dummies Questions & Answers

Sort / ascending order

What's the command to sort a file in ascending order and redirect the output to another file? Thanks!!!!!! (1 Reply)
Discussion started by: gyik
1 Replies
Login or Register to Ask a Question