- 论坛徽章:
- 0
|
有个文本内容:
current,server_ipaddr=10.0.18.113,ftp_user=yiyang,password=yiyang,start_time=2006-12-01 01:01:01,end_time=2006-12-31 00:00:00,agent_conf_path=/tmp
next,server_ipaddr=10.0.18.113,ftp_user=yiyang,password=yiyang,start_time=2006-10-10 12:12:12,end_time=2006-12-12 10:10:10,agent_conf_path=/opt/boco/agent/conf
我使用这样的shell语句解决分析,
line=`cat $AGENT_FILE|grep "current"`
if [[ "x$line" != "x" ]]; then
server_ip[1]=`echo $line|awk -F, '{ if($2~/^server_ipaddr=/) { print substr($2,15 ) } }'`
ftp_user[1]=`echo $line|awk -F, '{ if($3~/^ftp_user=/) { print substr($3,10 ) } }'`
ftp_pass[1]=`echo $line|awk -F, '{ if($4~/^password=/) { print substr($4,10 ) } }'`
start_time[1]=`echo $line|awk -F, '{ if($5~/^start_time=/) { print substr($5,12 ) } }'`
end_time[1]=`echo $line|awk -F, '{ if($6~/^end_time=/) { print substr($6,10 ) } }'`
conf_path[1]=`echo $line|awk -F, '{ if($7~/^agent_conf_path=/) { print substr($7,17 ) } }'`
fi
感觉非常慢,可能使用了太多的|管道连接进程了.是否还有其他更好的解分析方法呢? |
|