请尝试以下操作。(正在创建变量
line
属于
awk
这将有你的新产品的价值)
awk -v line='#BalancerMember "ajp://10.x.x.xxx:8009" route=node8 loadfactor=1 keepalive=on ttl=300 max=400 timeout=300 retry=60' '
/ProxySet lbmethod=byrequests/{
print " " line ORS $0
next
}
1' Input_file
说明:
在此处添加上述代码的说明。
awk -v line='#BalancerMember "ajp://10.x.x.xxx:8009" route=node8 loadfactor=1 keepalive=on ttl=300 max=400 timeout=300 retry=60' ' ##Creating variable line.
/ProxySet lbmethod=byrequests/{ ##Checking condition here if a line has string ProxySet lbmethod=byrequests then do following.
print " " line ORS $0 ##Printing space then variable line ORS and then print currrent line value then.
next ##Mentioning next out of the box keyword to skip all further statements.
}
1 ##Mentioning 1 will print the lines here, awk works on condition then action, making condition true here, print action will happen.
' Input_file ##Mentioning Input_file name here.