用来提取sql中的两个变量值
sql:UPDATE XXXX SET `SEQ` = ‘123456’, yyy=’xxx’ where SEQ = 123457
#!/bin/sh
int_regex=([0-9]+)
grep UPDATE pg.sql |grep HK_SAKCHMJSHH|while read line
do
first_seq_pos=`echo $line|awk ‘{print index($0,”x60SEQx60 = x27″)}’`
second_seq_pos=`echo $line|awk ‘{print index($0, “SEQ = “)}’`
if [ $first_seq_pos -ne $second_seq_pos ];then
((first_seq_pos=$first_seq_pos+9))
((second_seq_pos=$second_seq_pos+6))
first_seq=`echo $line |awk -v pos=”$first_seq_pos” ‘{print substr($0, pos, 8) }’`
second_seq=`echo $line |awk -v pos=”$second_seq_pos” ‘{print substr($0, pos, 8) }’`
echo $first_seq
if [[ $first_seq =~ ([0-9]+) ]];then
echo “match:”${BASH_REMATCH[1]}
fi
echo $second_seq
exit
fi
done