$SQL_RESULT is usually something like this:
TDM_PROC
-------------------------------------------------------------------
N
I need to extract the last word from it (N in this case).
In bash 3.2 I used this expression:
if [[ $SQL_RESULT =~ "(\w+)$" ]] ; then
RES=${BASH_REMATCH[1]}
else
echo "Error" > $LOG_FILE
exit 1
fi
I found that in bash 4 I should not use the quotes but it still does not work
if [[ $SQL_RESULT =~ (\w+)$ ]] ; then
RES=${BASH_REMATCH[1]}
else
echo "Error" > $LOG_FILE
exit 1
fi
Any help appreciated.