GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: getting the next number
Operating System - HP-UX
1855657
Members
8697
Online
104113
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp
Knowledge Base
Discussions
Forums
Discussions
back
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
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
09-27-2004 08:23 AM
09-27-2004 08:23 AM
In a file I have a column that has numbers in it. I need to sort that column, get the largest number and add 1 to it. Anyone have any ideas how to do that?
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2004 08:26 AM
09-27-2004 08:26 AM
Solution
Say if your file has the following format
text text2 677
text3 text4 788
then
typeset -i LARGEST=0
LARGEST=$(sort -nbk 3 inputfile | tail -1 | awk '{print $3}')
(( LARGEST=LARGEST + 1 ))
echo $LARGEST
text text2 677
text3 text4 788
then
typeset -i LARGEST=0
LARGEST=$(sort -nbk 3 inputfile | tail -1 | awk '{print $3}')
(( LARGEST=LARGEST + 1 ))
echo $LARGEST
Learn What to do ,How to do and more importantly When to do ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2004 08:55 AM
09-27-2004 08:55 AM
Re: getting the next number
1)cat filename |awk '{ print $colnum }'|sort
$colnum is the column you want to select
2)cut -d" " -f$colnum |sort
-Cheers
Govind
$colnum is the column you want to select
2)cut -d" " -f$colnum |sort
-Cheers
Govind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2004 09:00 AM
09-27-2004 09:00 AM
Re: getting the next number
Thank you. That got me pointed in the right direction.
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 2026 Hewlett Packard Enterprise Development LP