我有一个查询导致以下数据
询问 :
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"
结果 :
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.
现在我正在编写一个脚本,它采用第 2 列并进行比较,如果 < 1000 那么我们在打印中提到 col1 和 col2
所以我写的脚本是
#!/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";
我已经给出了打印来测试我成功地消除了'-----'第一行和最后一行......这样我就可以拆分并初始化为 3 个变量并在 foreach 循环中进行计算,但是某处出错........帮助表示赞赏