I have this output in a variable called ...yes $OUTPUT original...huh
these are tablespaces in an Oracle db
how do I get this into another variable in two columns
so I can do a check on the numbers (space left)
SYSTEM 290; USERS 19; UNDOTBS1 1863; DATA 5982; SYSTEM 290; USERS 19; UNDOTBS1 1863; DATA 5982;
OUTPUT=`sqlplus -s '/ as sysdba' <<-EOF
set heading off feedback off serveroutput on trimout on pagesize 2
select tablespace_name,trunc(sum(bytes)/1024/1024)||';' MB_free from dba_free_sp
ace group by tablespace_name;
/
EOF`
echo "$OUTPUT" | awk 'BEGIN{FS=";";OFS="\n"} { $1=$1;print}' | while read col1 col2; do echo col1
do u want to print as follows,
table space SYSTEM has 290 MB space left.
table space USERS has 19 MB space left.
table space UNDOTBS1 has 1863 MB space left.
table space DATA has 5982 MB space left.
table space SYSTEM has 290 MB space left.
table space USERS has 19 MB space left.
table space UNDOTBS1 has 1863 MB space left.
table space DATA has 5982 MB space left.