The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
SSH problems ysk UNIX for Advanced & Expert Users 1 07-19-2007 02:16 AM
Problems AIX and SAN. fjgonzalez AIX 4 07-18-2007 02:15 PM
Problems with Last By_Jam UNIX for Advanced & Expert Users 3 09-29-2006 12:12 AM
Few problems vivekshankar UNIX for Dummies Questions & Answers 3 05-21-2005 09:26 AM
'make' problems (compliation problems?) xyyz UNIX for Advanced & Expert Users 5 11-05-2001 07:47 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-07-2005
Registered User
 

Join Date: Nov 2005
Posts: 1
awk problems

If i try the -f option for awk, i get the "awk: can't open " error message
The following awk statement works fine without the -f option
`awk <$RULES '/^IGNORE_POLICY / { print $2 }'`


Below how i turned on debugging to show what is happening, can someone provide me with some advice!!!!

$RULES = /home/nberrors_rules_jm_NEW.txt_TEST
$2 = ^219$ of the following (STATUS_MESSAGE ^219$ See BOA-NBU-1. Partial success)

MESSAGE=`awk <$RULES '/^STATUS_MESSAGE / && '$STCODE' ~ $2 { for(a=3;a<NF+1;a++) { printf "%s ",$a }}'`
...........
+ + awk /^STATUS_MESSAGE / && 219 ~ $2 { for(a=3;a<NF+1;a++) { printf "%s ",$a }}
+ 0< /home/nberrors_rules_jm_NEW.txt_TEST
awk: syntax error near line 1
awk: bailing out near line 1
MESSAGE=


STCODE_POL_MESSAGE=`awk <$RULES '/^STATUS_MESSAGE_POLICY / && '$STCODE' ~ $2 && toupper("'$POLICY'") ~ toupper($3) { for(a=4;a<NF+1;a++) { printf "%s ",$a }}'`
...........
+ + awk /^STATUS_MESSAGE_POLICY / && 219 ~ $2 && toupper("emacromsq14") ~ toupper($3) { for(a=4;a<NF+1;a++) { printf "%s ",$a }}
+ 0< /home/nberrors_rules_jm_NEW.txt_TEST
awk: syntax error near line 1
awk: bailing out near line 1
STCODE_POL_MESSAGE=
Reply With Quote
Forum Sponsor
  #2  
Old 11-07-2005
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,249
Your command-line syntax is confusing, but I do not see any program syntax errors. Maybe try...
Code:
MESSAGE=`awk '/^STATUS_MESSAGE / && STCODE ~ $2 {for(a=3;a<=NF;a++) printf "%s ",$a}' STCODE="$STCODE" $RULES`
Make sure you are using the newer awk, called nawk on some systems.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 06:12 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0