Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exception in a regular expression

Status
Not open for further replies.
Joined
Jun 21, 2006
Messages
6
Location
US
Hi

I ma getting the following error while executing the script .

Error message

# ./check_syntax
./check_syntax: line 115: syntax error near unexpected token `('
./check_syntax: line 115: ` /[A-Z]\=\`*\`/ { printf("\"%s\"\n", $0); next } \'


The line 115 is

awkOutput=`$AWK 'BEGIN { Ni=0 } \
/^#/ { next } \
/[A-Z]\=\`*\`/ { printf("\"%s\"\n", $0); next } \
/[A-Z_]\=/ { next } \
/^$/ { next } \
{ printf("\"%s\"\n", $0); next }' $ENV_FILE`

Please let me know if there are any syntax errors in the expression.


Regards
Upilli
 
Hmm
Your code works fine under AIX 5.1. Are yo sure you copied it correctly?
Also the code is a little strange
The same effect could be done with
Code:
awkOutput=$($AWK '!/^#/ && !/^$/ {print}' $ENV_FILE)
but I guess you're going to do things with the different types of line. Even so the printf is over the top when a simple print will do.
Also are you sure you don't mean /[A-Z]+\=/ and /[A-Z_]+\=/ for the two expressions.


Ceci n'est pas une signature
Columb Healy
 
Hi

I can only confirm that it works on Linux too, with [tt]gawk[/tt] and [tt]mawk[/tt]. At least for my test files, as you did not provided one.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top