Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

error/return code of awk script

Baraka69 (Programmer) (OP)
24 Apr 03 3:50
I have an AWK script that has to plow through an access_log (apache web server) and I have a surfer/user (lucky for me he has a fixed ip-address) that produces lines that are longer than 3,000 bytes/characters and then my awk script quits with an error message (don't have the exact wording, but can supply it, if it is necessary).

I can get rid of the lines that are too long using SED, but for now I have to do it all manually.

I want to have a shell script to call (and run) my awk script. If the awk script fails because the input file contains lines that are too long, it should (but only in this case) run my SED script and afterwards run the AWK script again.

My question is: how do I read the exit code of my AWK script? Is there an exit code? My guess is that there might be an exit code greater ZERO if an error occurs.

Anyone know for sure?
vgersh99 (Programmer)
24 Apr 03 8:47
I believe that's been answered in another forum.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+

Baraka69 (Programmer) (OP)
24 Apr 03 9:41
Quite right. I found the UNIX Forum and posted a similar question there. An answer got me going and now I am a lot further into this matter.

My particular question here was what are the AWK exit codes?

For my example I found out that the exit code is "2".
The error Message displayed was:
"awk: Input line LINEDATA cannot be longer than 3,000 bytes."

I failed to find any information on exit codes (I have some good print/web sources, but they come up empty, apart from the "exit" statement).
vgersh99 (Programmer)
24 Apr 03 9:46
here's the excerp from nawk's man page:

EXIT STATUS
     The following exit values are returned:

     0         All input files were processed successfully.

     >0        An error occurred.

     The exit status can be altered within the program  by  using
     an exit  expression.

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close