0
点赞
收藏
分享

微信扫一扫

linux逐行逐列(分号分隔)读取数据shell

 shell脚本:

#!/bin/bash
dhistory=/root/history
cellname=rhel77
E_class=PATROL_EV
msg='patrolagent is disconnected'

function read_line_top_bottom()
{
  while read line
  do
    a=`echo $line | awk -F";" '{print $1}'`
    b=`echo $line | awk -F";" '{print $2}'`
    msend -n rhel77 -a PATROL_EV -m "$msg" -b "mc_host=$a;mc_host_address=$b"
  done < /root/aa.txt
}
read_line_top_bottom

aa.txt

1.1.1.1;aa
2.2.2.2;bb



举报

相关推荐

0 条评论