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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AWK error message "arg list too long"

Status
Not open for further replies.

rufflocks

Technical User
Jun 29, 2001
26
US
I wrote an awk script. It executed successfully untill I added quite a few lines of comments (for readability). The awk swcipt is 528 lines long with 17282 characters.
Any idea how I can get successful execution without removing the comments?
 
Hi rufflocks,

Generally, comments can be placed
conveniently except in a few cases.

Usually a comment is added at the right
side of an awk statement:

print $4 # special value for wombat v16

However, you should not put commnents in
when they will interfere with the parsing
that the awk interpreter does:

# special variable for finance cost="$112.16"
( cost will never be seen )

-OR-

/report/ { print $5" "$6" "$9" "$3" "\ # good info here
$2" "$1"\n"}
( line will not be continued as it should be )

These are O.K.:

# This report is interesting
# in that it shows the value
# of controlling costs

#if ( $5 == "totcost") { # oops, wrong test

if ( $5 ~ "totcost") { # test for correct string
print "The cost balances our needs"
} else { print "The cost is excessive"} # exceeds range

So, if you avoid conflict with the interpreter, all
should run just fine.

Since everything following the comment is ignored,
make sure that the comment does not actually void
an awk statement accidentally!

Also, if you didn't already know, a comment MUST be
preceded with the sharp sign ( # ) as shown above.

Hope this helps you!



flogrr
flogr@yahoo.com

 
Thanks. Your suggestions did not work for me.

Is there a command to invoke the awk compiler that would actually point to the line it is having problems with?
 
If you use nawk or gawk the interpreter will tell you
the line number and display the context of the
error.

Other than that, just supply a representative example
and we can further analyze what is going on.

Also, what platform are you running on and what
shells are available to you?

Jesse

flogrr
flogr@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top