The challenge I am facing is that I have to manipulate the 5th column in my file (record.txt) inside awk, then I have to pass the 5th column value to a
function in my script, the function will do some manipulation and test. The function will return 0 if the test is good and 1 if not. The returning
value of 0 and 1 will be return back to awk and awk will test it. If the returning value of my function is 0 awk will display the whole row ($0)
and do nothing if returning value of function is 1.
The use of cat with awk is redundant.
To call your script you can use the system() function.
Try this, if the returncode of your script is 0 (not true, hence the "!" before the system command) awk should print the whole line:
You can call programs or scripts with the system() command but not a shell function with awk within a script like this.
If you want to manipulate the data with a shell script, you have to use separate scripts, one to manipulate the data and one with the awk command, but why don't you manipulate the data within awk?
Anyhow, if you want to play around with it, the scripts should look like:
awk script (you can also type the awk command at the prompt):