使用这个返回多行结果:awk脚本,需要以下关键字
awk '$1 == "pool" { f=1; print $1,$2; next }
f == 1 { if ($1 == "pool") { print }
else if ($1 == "members") { print }
else if ($0 ~ /^}/) { f=0 }
}' bigip.conf
也就是说,直到配置有以下行的IP地址工作正常。 我如何获得它打印IPs,如果他们在以下线路上。 配置有两个,有一些在同一行上,一些在下一个1,2或3行。
数据:
pool pl_stage_xxx_microsites_9483 {
monitor all tcp_half_open
members {
11.11.11.11:9483 {}
11.22.22.22:9483 {
session user disabled
}
}
}
heh,我的awk脚本:D – c00kiemon5ter
[this](http://stackoverflow.com/questions/12902353/bash-if-then-script-to-parse-file)是第一个问题 – c00kiemon5ter