- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How to sort by two keys?
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
Forums
Discussions
Discussions
Discussions
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
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
04-23-2001 05:10 PM
04-23-2001 05:10 PM
How to sort by two keys?
Thanks for advices.
128.188.1.102
128.188.1.103
128.188.1.105
128.188.1.52
128.188.1.66
128.188.1.67
128.188.1.68
128.188.1.71
128.188.3.104
128.188.3.15
128.188.3.20
128.188.3.56
128.188.3.58
128.188.3.62
128.188.3.71
128.188.3.88
128.188.3.92
128.188.5.150
128.188.5.162
128.188.5.163
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 11:38 PM
04-23-2001 11:38 PM
Re: How to sort by two keys?
sort -t. -k3n file1 | sort -t. -k4n
Carsten
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 11:39 PM
04-23-2001 11:39 PM
Re: How to sort by two keys?
sort -t. -k3n,3 -k4n,4
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2001 11:42 PM
04-23-2001 11:42 PM
Re: How to sort by two keys?
when using the -k option for a specific field you have to define an end_field, otherwise it uses end of line. If you ommit the end_field in the sortkey for field 3 it includes field 4 and the next option for field 4 will be ignored
So this should work:
sort -t. -k3n,3n -k4n file1
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2001 05:02 PM
04-24-2001 05:02 PM
Re: How to sort by two keys?
Another alternative "sort -t. -k3n jp1|sort -t. -k4n" definitely cannot because it is equivalent of one simple sort "sort -t. -k4n".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2001 11:32 PM
04-24-2001 11:32 PM
Re: How to sort by two keys?
Hope that helps, if all else fails then man sort!