Re: Is it possible to test the return value of awk statements?
- From: Janis Papanagnou <janis_papanagnou@xxxxxxxxxxx>
- Date: Mon, 26 Jan 2009 08:27:31 +0100
Chris Jones wrote:
On Sun, 25 Jan 2009 20:47:24 +0100, [..] wrote:
[..]
Do you expect all awk functions to return error codes similar to
shell?
You still didn't provide code and don't speak of the syntax error any
more, so I assume that part is okay now? If not then provide complete
code.
I'm writing a simple awk script. I have coded a printf statement. Upon
returning from the printf, I need to know whether the printf was
succesful.
What is an unsuccessful printf? If you provide characters to be print
as numbers? Or if the conversion is "okay" but the output device is
unavailable? You didn't answer the question:
"And then tell what you expect. - Do you expect all awk functions
to return error codes similar to shell? "
I read various online tutorials, I read the awk man page a few times, I
googled for hours and I still couldn't find anything.
So I thought I would subscribe to comp.lang.awk and ask there, hoping
someone knowledgeable would have the kindness to point me in the right
direction.
Sure if you _cooperate_ and make clear (by answering the questions!)
what your problem actually is.
Awk is not shell. Printf in awk is a kind of procedure action, while
as a shell builtin it's a command with defined exit status.
Off the top of my head; getline is the only command in awk that can
be checked for errors, I/O errors to be more specific. Awk's string
functions return strings or decimal results, awk's mathematical
functions return the expected numerical values.
In other words, how do I do that?
Check your input (using regexps) before you feed it to any function.
Janis
.
CJ
- Follow-Ups:
- Re: Is it possible to test the return value of awk statements?
- From: Chris Jones
- Re: Is it possible to test the return value of awk statements?
- References:
- Testing an awk statement's return value
- From: Chris Jones
- Re: Testing an awk statement's return value
- From: Janis Papanagnou
- Re: Is it possible to test the return value of awk statements?
- From: Chris Jones
- Testing an awk statement's return value
- Prev by Date: Redirecting output--please help needed!!!
- Next by Date: Re: Redirecting output--please help needed!!!
- Previous by thread: Re: Is it possible to test the return value of awk statements?
- Next by thread: Re: Is it possible to test the return value of awk statements?
- Index(es):
Relevant Pages
|