How to get the return value of a awk in a shell script?
awk -F['|'] '{print $6}' file.txtIn the above if the column 6 is null the script fails. How can I get the return value to do a check after this.
Thanks
Siva
Hi,
I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.Thanks
Siva

Null fields are perfectly valid and not considered an error by awk. But you can force whatever exit code you want: awk -F['|'] '{
if ($6=="")
exit 1
else
print $6}' file.txtawkstatus=$?
if [ $awkstatus -ne 0 ] ; then
echo "awk exited with status code of $awkstatus"
fiawk exited with status code of 1
Okay, great. Thanks. Siva
Hi,
I'm trying to replace a column in a comma seperated file with a column in another file using sed/awk. Can anyone help me.Thanks
Siva
