- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk changed/fails at 11.31 vs. 11.23
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
тАО06-06-2011 07:06 AM
тАО06-06-2011 07:06 AM
11.23:
# cat /home/oracle/check_agent.sh | awk '/first/ /second/ {{print $0}}'
first_line=`awk 'NR == 101 { print $NF }' $LINE`
if [ "${first_line}" != "" ]; then
if [ $first_line != "" ]; then
11.31:
# cat /home/oracle/check_agent.sh | awk '/first/ /second/ {{print $0}}'
syntax error The source line is 1.
The error context is
/first/ /second/ >>> { <<<
awk: Quitting
The source line is 1.
Help! I'm no awk programmer - this is a customer's script.
Solved! Go to Solution.
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 07:30 AM
тАО06-06-2011 07:30 AM
SolutionAt the moment, I don't have an 11.23 box handy to check, but the syntax you show isn't correct.
Depending on what you want, do either:
# awk '/first|second/ {print $0}' file
...which prints lines that match *either* "first" or "second"; or:
# awk '/first/,/second/ {print $0}' file
...which prints all lines between ones matching "first" and then "second".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 07:49 AM
тАО06-06-2011 07:49 AM
Re: awk changed/fails at 11.31 vs. 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 08:13 AM
тАО06-06-2011 08:13 AM
Re: awk changed/fails at 11.31 vs. 11.23
I tried it on 11.11 and it does work - I can't find any reference to this sort of syntax on the man pages - one wonders if it was an old syntax which was deprecated or simply a bug which some folks have exploited and is now fixed...
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 08:44 AM
тАО06-06-2011 08:44 AM
Re: awk changed/fails at 11.31 vs. 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 09:38 AM
тАО06-06-2011 09:38 AM
Re: awk changed/fails at 11.31 vs. 11.23
awk performs operations for me on 11.11 11.23 and 11.31 consistently.
I would assume you have run into a defect resolved by patching. Most likely a relatively current QPK will do the trick.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 10:49 AM
тАО06-06-2011 10:49 AM
Re: awk changed/fails at 11.31 vs. 11.23
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 11:07 AM
тАО06-06-2011 11:07 AM
Re: awk changed/fails at 11.31 vs. 11.23
> A QPK for 11.23 or 11.31?
I think neither. In my opinion, Duncan offers the explanation. This was probably a clean-up of a "bug" when 11.31 was rolled out.
For cases like this, you can look to the Patch database for the particular release (e.g. 11.23) and a patch applicable to 'awk'. The patch notes *might* offer insight in cases like this.
That said, your syntactically incorrect code failed to follow the correct 'pattern-action' syntax of 'awk'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-06-2011 10:22 PM
тАО06-06-2011 10:22 PM
Re: awk changed/fails at 11.31 vs. 11.23
Not a patch issue I think - it was the first thing I thought of, and I didn't find anything appropriate in any awk patch README files - are you saying you *ran* this awk code successfully and un-modified on a 11.31 system?
If you did, then I'd like to see an output of:
what /usr/bin/awk
from that system...
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-07-2011 12:21 AM
тАО06-07-2011 12:21 AM
Re: awk changed/fails at 11.31 vs. 11.23
Most likely. It seems it used to do: /first/ || /second/
Or JRF's: /first|second/
The closest fix I can find is the Unix 2003 branding fix: QXCR1000530363