php /data/www/GatewayWorker-Zhuanye/start.php status
Workerman[/data/www/GatewayWorker-Zhuanye/start.php] status
----------------------------------------------GLOBAL STATUS----------------------------------------------------
Workerman version:3.5.3 PHP version:7.0.5
start time:2019-04-25 11:34:13 run 34 days 21 hours
load average: 0.01, 0, 0 event-loop:\Workerman\Events\Event
1 workers 8 processes
worker_name exit_status exit_count
zhuanye 64000 149
----------------------------------------------PROCESS STATUS---------------------------------------------------
pid memory listening worker_name connections send_fail timers total_request qps status
42782 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633711 0 [idle]
42820 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633708 0 [idle]
42822 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633710 0 [idle]
42824 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633757 0 [idle]
42837 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633684 0 [idle]
42897 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633637 0 [idle]
42910 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633703 0 [idle]
42914 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633644 0 [idle]
root:~#cat cao
total 3164
-rw-r--r-- 1 root root 115 2010-03-13 01:24 awk
-rw-rw-rw- 1 root root 182870 2004-01-29 19:07 mp.xml
-rw-r--r-- 1 root root 210668 2010-03-03 14:49 6.zip
drwxr-xr-x 3 root root 4096 2009-11-22 13:35 arch
-rwxr-xr-x 1 root root 93 2010-03-09 16:49 co.sh
-rw-r--r-- 1 root root 0 2010-03-11 18:30 direct
-rwxr-xr-x 1 root root 73 2010-03-10 10:31 gesid.sh
-rwxr-xr-x 1 root root 1049 2010-03-10 14:06 getsh
-rw-r--r-- 1 root root 364 2010-03-13 02:27 hosts
-rw-r--r-- 1 root root 125 2010-03-13 01:33 kv
-rw-r--r-- 1 root root 76 2010-03-12 11:31 message
:~# awk 'BEGIN{print "sum"}NR==3{if($2<$5){$9=$2+$5;print $9}}' cao
sum
182871
~# awk 'BEGIN{print "sum"}NR==3{if($2<$5){$9=$2+$5}}END{print $9}' cao
sum
###还有一个空行,注意###
注意下面第三条的解释。
1.首先AWK处理文本的时候 是一行一行的读,一行一行的处理
2.你加了NR==3这个条件,只有这个条件成立的时候才执行后面的action
3.END 是在所有文件读入完以后 再执行的action原因在于$9与sum不同。$9是字段引用,而sum是自定义变量。字段是随着记录而变化的,sum不会。
Workerman[/data/www/GatewayWorker-Zhuanye/start.php] status
----------------------------------------------GLOBAL STATUS----------------------------------------------------
Workerman version:3.5.3 PHP version:7.0.5
start time:2019-04-25 11:34:13 run 34 days 21 hours
load average: 0.01, 0, 0 event-loop:\Workerman\Events\Event
1 workers 8 processes
worker_name exit_status exit_count
zhuanye 64000 149
----------------------------------------------PROCESS STATUS---------------------------------------------------
pid memory listening worker_name connections send_fail timers total_request qps status
42782 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633711 0 [idle]
42820 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633708 0 [idle]
42822 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633710 0 [idle]
42824 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633757 0 [idle]
42837 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633684 0 [idle]
42897 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633637 0 [idle]
42910 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633703 0 [idle]
42914 2M websocket://127.0.0.1:943 zhuanye 49 0 3 2633644 0 [idle]
root:~#cat cao
total 3164
-rw-r--r-- 1 root root 115 2010-03-13 01:24 awk
-rw-rw-rw- 1 root root 182870 2004-01-29 19:07 mp.xml
-rw-r--r-- 1 root root 210668 2010-03-03 14:49 6.zip
drwxr-xr-x 3 root root 4096 2009-11-22 13:35 arch
-rwxr-xr-x 1 root root 93 2010-03-09 16:49 co.sh
-rw-r--r-- 1 root root 0 2010-03-11 18:30 direct
-rwxr-xr-x 1 root root 73 2010-03-10 10:31 gesid.sh
-rwxr-xr-x 1 root root 1049 2010-03-10 14:06 getsh
-rw-r--r-- 1 root root 364 2010-03-13 02:27 hosts
-rw-r--r-- 1 root root 125 2010-03-13 01:33 kv
-rw-r--r-- 1 root root 76 2010-03-12 11:31 message
:~# awk 'BEGIN{print "sum"}NR==3{if($2<$5){$9=$2+$5;print $9}}' cao
sum
182871
~# awk 'BEGIN{print "sum"}NR==3{if($2<$5){$9=$2+$5}}END{print $9}' cao
sum
###还有一个空行,注意###
注意下面第三条的解释。
1.首先AWK处理文本的时候 是一行一行的读,一行一行的处理
2.你加了NR==3这个条件,只有这个条件成立的时候才执行后面的action
3.END 是在所有文件读入完以后 再执行的action原因在于$9与sum不同。$9是字段引用,而sum是自定义变量。字段是随着记录而变化的,sum不会。
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/3464/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2019-5-30 09:58
评论列表