- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Setting a value with AWK
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
тАО02-09-2009 02:07 PM
тАО02-09-2009 02:07 PM
If I have a value greater then 6 then define it as the next value, so 6=7, 7=8, 8=9, 9=10 upto a max of 20, and if the value is NULL or empty define it as 6.
CURDOCID=`awk -F"|" '{print $1}' /tmp/jacunload.txt`
NEWDOCID=${CURDOCID}+1
echo ${NEWDOCID}
CURDOCID Is integer or is NULL.
If it is null I want to assign a value of 6 to NEWDOCID if is valued I want to increment it but 1.
any assistance appreciated deeply
Solved! Go to Solution.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2009 03:07 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2009 03:15 PM
тАО02-09-2009 03:15 PM
Re: Setting a value with AWK
echo "${CURDOCID:-6}"
will default to 6 if not set to anything else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-09-2009 03:18 PM
тАО02-09-2009 03:18 PM
Re: Setting a value with AWK
Why not let 'awk' do everything!?!
# awk '{if (NF<=1) {print "6";next};if ($2>5 && $2<21) {print $2+1} else {print $2}}' file
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-10-2009 06:06 AM
тАО02-10-2009 06:06 AM
Re: Setting a value with AWK
I am reinventing a major script that has been a mess from the outset combining the function of about 6 scripts into a much more streamline solution.
Awk has been my friend for some time but my scripting knowledge or lack their of limited how much I used it. It has become a very important tool.
Thanks for all that replied.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-10-2009 06:43 AM
тАО02-10-2009 06:43 AM