读取SQL查询并输出到shell(ARRAY),循环并打印结果

时间:2018-02-21 20:53:19

标签: shell unix

我正在尝试读取sql查询结果并打印出结果.... 寻找第二意见......

sqlplus -s $database userinfo << b > abc.tmp

    set head off
    set verify off
b
    IFS=","
    select * from jobs where job no in (1, 2, 3, 4);

    while read -r col1 col2
    echo $result
    done < abc.tmp

结果“

Print,  11
Delete; 5
Send,   6

澄清。

I have the output I need, but now need to process it in an array and query column values  (second)  value which is for instance print is 11.

如果该值小于4,我需要回显(打印该行)。

例如,

Print,  3
Delete; 5
Send,   6


Print,  3

Echo - 打印作业尚未运行...

0 个答案:

没有答案