- 论坛徽章:
- 0
|
[root@Dan scripts]# more awksrc99
BEGIN{RS="listen *test[0-9a-zA-Z]*"}
{
if(NR>1){
if (newRt == var1){
$0=R$0"\n dfdf"var2"ddd"
}else{
$0=R$0
}
}
newRt=gensub(/listen */,"",1,RT)
R=RT
print
}
[root@Dan scripts]# more sh74.sh
#!/bin/bash
awk -v var1=$1 -v var2=$2 -f awksrc99 linux.124
[root@Dan scripts]# sh sh74.sh test2 192.168.10.11
listen test 192.168.0.10:8888
balance roundrobin
option forwardfor
# option ssl-hello-chk
server web1 192.168.0.100:8091 weight 1 maxconn 5000 check
server web1 192.168.0.101:8091 weight 1 maxconn 5000 check
listen test2 192.168.0.9:8080
balance roundrobin
option forwardfor
option ssl-hello-chk
server web1 192.168.0.150:9090 weight 1 maxconn 5000 CHECK
dfdf192.168.10.11ddd
我也写了一个HOHO~跟大家分享一下 |
|