Operating System - Linux
1753677 Members
5583 Online
108799 Solutions
New Discussion

Need help in sort:“sort: Cannot use more than 9 sort keys”

 
SOLVED
Go to solution

Need help in sort:“sort: Cannot use more than 9 sort keys”

Hello,
Can someone help me in resolving following error, “sort: Cannot use more than 9 sort keys”?
We have Hp Unix B.11.11 U 9000/800 with perl, v5.8.0
Thanks in Advance


Regards
Srini
It Has Been...
4 REPLIES 4
Peter Godron
Honored Contributor

Re: Need help in sort:“sort: Cannot use more than 9 sort keys”

Hi,
see "man sort":
"A maximum of 9 -k options can be given"

You are trying to sort the file by too many keys. Reduce the number of keys.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Need help in sort:“sort: Cannot use more than 9 sort keys”

Hi Srini:

You have an opportunity to improve your sort times let alone handle the necessary number of sort keys.

Before sorting, construct a sort key at the end or at the beginning of your records that consists of the multiple keys you need stated in the relative order of sort importance.

Then, sort on the manufactured single key. Trim the sort key from your record before you create your output.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Need help in sort:“sort: Cannot use more than 9 sort keys”

>JRF: You have an opportunity to improve your sort times ...that consists of the multiple keys

If this was an industrial strength sort routine, it would already do that. ;-)
At least that's what the system sort on MPE/iX did.

You are probably correct that sort(1) doesn't do that.

Re: Need help in sort:“sort: Cannot use more than 9 sort keys”

I have changed the code.
Thanks for suggestion.

Regards
Srini
It Has Been...