- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sorting stuff
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
05-06-2002 12:45 PM
05-06-2002 12:45 PM
I have an arbitrary input in the following form:
c0t11d2 NONE 4095 JBOD/Other SEAGATE
c0t8d1 NONE 4095 JBOD/Other SEAGATE
c0t9d0 NONE 4095 JBOD/Other SEAGATE
I need to perform sort on device field (dX).
I am thinking of using
sort -k 1.LengthOfTheDevice (e.g. sort -k 1.6) filename
Since, the disk name is of variable length, how can I ensure that I always search based on D value?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 12:59 PM
05-06-2002 12:59 PM
Re: sorting stuff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 01:09 PM
05-06-2002 01:09 PM
Re: sorting stuff
Suppose, the following info I have:
c0t0d0 NONE 4095 JBOD/Other SEAGATE
c0t0d1 NONE 4095 JBOD/Other SEAGATE
c1t0d0 NONE 4095 JBOD/Other SEAGATE
c1t1d1 NONE 4095 JBOD/Other SEAGATE
When I sort by d, I also need to make sure that the following output displayed:
c0t0d0
c1t0d0
c0t0d1
c1t1d1
If I were to use the sort like this:
sort -t 'd' -n -k1,6 diskDBt
I'd get the following output:
c0t0d0
c0d0t1
c1t0d0
c1t1d1
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 01:18 PM
05-06-2002 01:18 PM
Re: sorting stuff
If we use 'd' as the field separator, then we need sort by the second field - correct?
If so, then try using -k2 instead of -k1,6
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-06-2002 01:28 PM
05-06-2002 01:28 PM
Solutionsort -t 'd' -k 2,2n -k1,1b infile