txt格式:
...
logport='13000'
sessionport='23000'
...
########################
只获取logport的赋值13000
awk '
BEGIN{
FS="="
}
{
if(/'logport'/){
FIRST=$
}
}
END{
print substr(FIRST,,length(FIRST)-)
}' txt
<---监控端口连接数--->
lsof -ni tcp: | awk '/:http/ {++S[$NF]} END {for(a in S) print a,S[a]}'