I'm trying to cut the string before the first space as I want to get the value returned from the DB request assigned to MINOR_VER variable.
The returned string is 3 1 row selected (overall time 6731 usec; server time 1281 usec)
and I only need 3 as an output.
My approach is to get the string and pass it to cut, but so far I couldn't reach the goal.
MINOR_VER_QUERY="select count(*) from $DB_SCHEMA.RPT where CASE_UUID='3'"
MINOR_VER=$(echo `hdbsql -a -n $HOST -i $INSTANCE -u $DB_USER -p $DB_PWD $MINOR_VER_QUERY` | cut -d' ' -f1)
hdbsql is hana database sql cli to create a db connecntion.
There is a -x flag available for hdbsql CLI that will drop the appended statistics from the returned result set. You may also find the -quiet flag to be helpful too. More info on available flags here
Instead:
MINOR_VER=$(hdbsql -x -quiet -a -n $HOST -i $INSTANCE -u $DB_USER -p $DB_PWD $MINOR_VER_QUERY)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With