|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Help on sort in Unix
Hi all,
I am a new user on this forum. nice to meet u all. I am a newbie on Unix and current having problem to solve my problem with the sort command. I have a file with 2 columns as the following: 0001 0012 0002 0089 0003 1234 0001 4567 0008 2456 0003 0028 0001 1011 0002 1112 I want to sort the first column in ascending order and then within the sorted first column, sort the second column in descending order. The following is the desire output: 0001 4567 0001 1011 0001 0012 0002 1112 0002 0089 0003 1234 0003 0028 0008 2456 Can anyone help me please? any help is appreciated. Thanks, Cheers |
|
#2
|
|||
|
|||
|
Oh, i have solved the problem.
For the sake of any new Unix user, like me, might want to know. Here is the solution I used. I solved it with multiple keydef (the -k option) the command is: sort -k 1,1 -k 2,2r infile.txt this sorts the first column first, and then sorts the 2nd column in reverse order. Cheers |
|
#3
|
|||
|
|||
|
what ??
Quote:
????????????????? what does: sort -k 2,2r infile.txt -k 2,2r IGNORES -k 1,1
__________________
working on Solaris[5-9], preferred languages french and C. |
|
#4
|
|||
|
|||
|
Quote:
Sorry again, sheriff, you are barkling up the mistaken tree. I have tried the snowmen's suggestion on Solaris and on AIX. On both systems is it OK. Show us YOUR ORIGINAL solution please. Congratulations! You have another post. You will get a better belt color. But the belt color does not say anythig about the bearer's quality. Regards ![]() |
|
#5
|
|||
|
|||
|
Sorry again, sheriff, you are barkling up the mistaken tree.
I have tried the snowmen's suggestion on Solaris and on AIX. On both systems is it OK. Show us YOUR ORIGINAL solution please. Congratulations! You have another post. You will get a better belt color. But the belt color does not say anythig about the bearer's quality. OK it works perfectly so does cat abc | lpr i believe you dont see the difference, i would try lpr abc ![]() remarque cat abc ABC | lpr is really NOT the same please stop your st... remarques |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Help on sort in Unix |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|