HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sorting strings
Operating System - HP-UX
1834154
Members
2506
Online
110064
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
10-14-2008 04:50 PM
10-14-2008 04:50 PM
Hiya guys,
Need help with sorting strings. My data looks like this:
dat11
dat1
dat33
dat3
dat10
dat30
dat20
dat31
dat2
the desired output is:
dat1
dat2
dat3
dat10
dat11
dat20
dat30
dat31
dat33
but oviously this would happen:
dat1
dat10
dat11
dat2
dat20
dat3
dat30
dat31
dat33
so, the question is how do i get the desired output done?
TIA!
Need help with sorting strings. My data looks like this:
dat11
dat1
dat33
dat3
dat10
dat30
dat20
dat31
dat2
the desired output is:
dat1
dat2
dat3
dat10
dat11
dat20
dat30
dat31
dat33
but oviously this would happen:
dat1
dat10
dat11
dat2
dat20
dat3
dat30
dat31
dat33
so, the question is how do i get the desired output done?
TIA!
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2008 08:37 PM
10-14-2008 08:37 PM
Solution
If your data is always 3 bytes then the number you can use:
sort -k1.1,1.3 -k1.4,1n
If it varies in size, you would have to split the data into two fields then sort and then merge.
But the moral of the story is that you should use leading zeroes with a fixed width for numbers.
sort -k1.1,1.3 -k1.4,1n
If it varies in size, you would have to split the data into two fields then sort and then merge.
But the moral of the story is that you should use leading zeroes with a fixed width for numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2008 08:53 PM
10-14-2008 08:53 PM
Re: Sorting strings
Wow! great solution,works perfectly fine. This would serve well, because our data will stay this way unless we move out to another system.
And yes, I do agree with the structure, it's just taht i cannot modify what has been implemented and is currently running.
Thanks!
And yes, I do agree with the structure, it's just taht i cannot modify what has been implemented and is currently running.
Thanks!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP