注意a的使用
[root@10-13-0-165 ~]# ps aux|awk '$0~/interface-ignore/&&$0 !~/awk/{print $NF}'|awk '{match($0,/interface-ignore-([0-9]{1,9})-([0-9]{1,5})-ignore-ignore/,a);printf("%d %d\n",a[1],a[2])}'
50000570 7850
50000584 8327
50000584 8539
[root@10-13-0-165 ~]#
IP=$(ifconfig |grep inet|head -1|awk '{print $2}');
[root@10-13-0-165 ~]# ps aux|awk '$0~/interface-ignore/&&$0 !~/awk/{print $NF}'|awk '{match($0,/interface-ignore-([0-9]{1,9})-([0-9]{1,5})-ignore-ignore/,a);printf("%d %d\n",a[1],a[2])}' |while read appid port;do echo "$appid $IP:$port";done
50000570 10.13.0.165:7850
50000584 10.13.0.165:8327
50000584 10.13.0.165:8539