- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sort via multiple keyfields
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
тАО04-22-2002 06:01 AM
тАО04-22-2002 06:01 AM
file1.10
file1.11
file1.8
file1.9
file2.1
file2.10
file2.2
file2.3
file3.1
file3.10
file3.2
so the result is:
file1.8
file1.9
file1.10
file1.11
file2.1
file2.2
file2.3
file2.10
file3.1
file3.2
file3.10
Already tried `ls | sort -n -t.` which sorts the first
field only and `ls | sort -n -t. +1` which sorts the second field only.
Also tried `ls | sort -n -t. -k 1,2` which sorts the
second field only.
Any ideas?
thanks,
Boy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2002 06:18 AM
тАО04-22-2002 06:18 AM
Re: sort via multiple keyfields
Try redirecting the output of the first sort into the second, as follows:
`ls | sort -n -t. | sort -n -t. +1`
This uses both the sorts you have already tried, but combining them together.
I'll try it later today and let you know how it goes....
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2002 06:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2002 06:33 AM
тАО04-22-2002 06:33 AM
Re: sort via multiple keyfields
Sorry John, the second `sort`
re-sorts the whole list according to the second field.
Boyd
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-22-2002 07:08 AM
тАО04-22-2002 07:08 AM
Re: sort via multiple keyfields
Apologies for posting an incorrect solution - I'd not considered the fact that the second sort would re-sort the whole list :-(
John