Hi All,
I read through the already existing AWK topics but could not find answers, so please help me out here:
Question1)
Scenario: there is a file containing lines and in each line there is a date written. (e.g. blabla blabla blabla Jun 27 )
I would like to catch those date information into variables in AWK. It seems I have a problem. That is the piece of code I use:
awk '
{ JOB_DAY=$6; JOB_MONTH=$5; print $JOB_DAY, $JOB_MONTH
} ' $TEMP_FILENAME
The error I got:
awk: Field $(Jun) is not correct.
The input line number is 1. The file is /tmp/temp_print.txt.2454279.
The source line number is 2.
Question2)
I would like to later on expand this code and use system("grep ':' $JOB_MONTH") command. The interesting this would be not the command's output, but the return code. How can I catch the return code of an external command call from within AWK?
Question3)
This AWK stuff is in a middle of a script. In the script I have functions defined. How can I refer to the script functions from AWK? Like normal command, or as they would be external command thus calling AWK's system() option?
As you can see I am pretty newbie but have read through tons of articles and could not find the answers.
Thanks,
BearCheese