- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sort problem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:40 AM
тАО11-26-2002 08:40 AM
S:997
S:998
C:998
S:999
C:999
S:1000
S:1001
S:1002
C:1000
I'm trying to sort based on the single character value in the first column and a numeric sort on the second column. I've tried the following command sorting the numeric column first and then the character column. I have also tried sorting (correctly) on the numeric column into a file and then applying the second sort to the contents of that file, but the numeric portion is in each instance reordered in ascending ascii order even though the second sort instructions should be limited to the first column.
My sort command:
sort -t: -k 2n,2n
Results in:
C:1000
C:998
C:999
S:1000
S:1001
S:1002
S:997
S:998
S:999
Desired result is:
C:998
C:999
C:1000
S:997
S:998
S:999
S:1000
S:1001
S:1002
All suggestions appreciated.
thanks,
tim
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:51 AM
тАО11-26-2002 08:51 AM
Re: sort problem
This should sort if for you:
sort -t: -k1,1 -k2,2n filename
Rgds, Robin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:52 AM
тАО11-26-2002 08:52 AM
Re: sort problem
sort -t: -k1,1 -k2n,2n
Gerrit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:54 AM
тАО11-26-2002 08:54 AM
Re: sort problem
Best regards...
Dietmar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2002 08:55 AM
тАО11-26-2002 08:55 AM
Re: sort problem
Problem solved.