sed、awk学习篇

[yongsan@yz6245 ~]$ awk 'BEGIN {FS=":"}{shells[$NF]++;}END{for(i in shells)print i ": " shells[i];}' passwd
/sbin/shutdown: 1
/bin/bash: 52
/sbin/nologin: 49
/sbin/halt: 1
/nologin: 1
/bin/sync: 1

[yongsan@yz6245 ~]$ cat passwd |sed 's!/bin/bash$!/sbin/nologin!g'

posted @ 2016-06-11 23:46  李永三  阅读(142)  评论(0编辑  收藏  举报