I am running an sql query from a bash script using spool and getting the below output.
#!/bin/bash
/usr/lib/oracle/12.2/client64/bin/sqlplus -s esg/esg << EOF
spool /tmp/test
< SOME SELECT QUERY >
spool off;
EOF
exit;
I am getting output as below:
cat /tmp/test
TABLESPACE_NAME USED_PCT
------------------------------ ----------
TEMP_TBS1 23
SYSAUX 4
GTEMP 3
SYSTEM 3
UNDOTBS2 0
UNDOTBS1 0
TEMP 0
USERS 0
DATA_TBS1 23
INDEX_TBS1 11
10 rows selected.
I want to get rid of everything except the values i.e., I do not want header,"--","10 rows selected" and ofcourse blank lines. This would look like below
TEMP_TBS1 23
SYSAUX 4
GTEMP 3
SYSTEM 3
UNDOTBS2 0
UNDOTBS1 0
TEMP 0
USERS 0
DATA_TBS1 23
INDEX_TBS1 11