sed命令

来源:互联网 发布:cimatrone11入门编程 编辑:程序博客网 时间:2024/06/06 14:03

在文件schedule_task_ha_monitor.sh中匹配CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh

并且打印行号

cat schedule_task_ha_monitor.sh | grep -n "CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh" | awk -F ":" NR==1'{print $1}'


line_num=$(cat schedule_task_ha_monitor.sh | grep -n "CHECK_IPTABLES=/opt/OperationCenter/AppBase/HA/hascript/check_iptables.sh" | awk -F ":" NR==1'{print $1}')

0 0
原创粉丝点击