I have a query which result in the following data
Query :
db2 "select RTRIM(substr(A.TBSP_NAME,1,30)),A.TBSP_FREE_PAGES as FREE,B.CONTAINER_NAME as CON_PATH from SYSIBMADM.TBSP_UTILIZATION A ,SYSIBMADM.CONTAINER_UTILIZATION B where A.TBSP_ID=B.TBSP_ID and A.TBSP_AUTO_RESIZE_ENABLED=0 with UR"
Result :
1 FREE CON_PATH
------------------------------ -------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
USERSPACE1 14736 /adrst/bdts/userspc_container
USERSPACE1 14736 /adrst/bdts/userspc_container1
MASTER 3472 /adrst/bdts/master_container
TRANS_DATA 1200 /adrst/bdts/trans_data_container
MASTER_INDEX 1840 /adrst/bdts/master_index_container
TRANSACTION_INDEX 960 /adrst/bdts/transaction_index_container
TEMP_SYS 2192 /adrst/bdts/temp_sys_container
AUDIT_DATA 3360 /adrst/bdts/audit_data_container
TEMP_USR 2672 /adrst/bdts/temp_usr_container
TSASNCA 2840 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNCA
TSASNUOW 2880 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNUOW
TSASNAA 3712 /home/db2inst1/db2inst1/NODE0000/SQL00002/TSASNAA
TSCDADDRESSMASTER 2048 /home/db2inst1/db2inst1/NODE0000/SQL00002/CDADDRESSMASTER
13 record(s) selected.
Now im writing a script which takes the column 2 and compares , if < 1000 then we mention col1 and col2 in print
So the script i have written is
#!/usr/bin/perl
use strict;
use warnings;
`db2 "connect to awdrt"`;
my @tbsp= grep /([a-zA-Z_]*)\s*([0-9]*)\s*([a-zA-Z_]*)/,`db2 "select RTRIM(substr(A.TBSP_NAME,1,30)),A.TBSP_FREE_PAGES as FREE,B.CONTAINER_NAME as CON_PATH from SYSIBMADM.TBSP_UTILIZATION A ,SYSIBMADM.CONTAINER_UTILIZATION B where A.TBSP_ID=B.TBSP_ID and A.TBSP_AUTO_RESIZE_ENABLED=0 with UR"`;
print "@tbsp";
I have given the print to test I am successful in eliminating the '-----' 1'st line and the last line ...so that i can split and initialize to 3 variables and do my calculation in foreach loop , but going wrong somewhere ........Help is appreciated