awk小记续_linux命令

########################

 

awk小记续_linux命令_02

###########

 

[root@qqdserver ~]# awk -F : '$1!~/root/{i=1;while (i<=4) {print $i; i++}}' /etc/passwd

bin

x

1

1

daemon

x

2

2

adm

x

3

4

lp

x

4

7

sync

x

5

0

shutdown

x

6

0

halt

x

7

0

mail

x

##########################################

 

 

[root@qqdserver ~]# awk -F : '$1!~/root/{i=1;while (i<=4) {printf $i; i++}}' /etc/passwd

binx11daemonx22admx34lpx47syncx50shutdownx60haltx70mailx812newsx913uucpx1014operatorx110gamesx12100gopherx1330ftpx1450nobodyx9999vcsax6969pcapx7777dbusx8181mailnullx4747smmspx5151sshdx7474mysqlx2727wwwx10001000wdcpux999999haldaemonx6868yujianlongx10011000oprofilex1616avahix7070xfsx4343cx10021002fashix10031000cactix10041004qingqingdaox10051005nagiosx10061007nagiosadminx10071008cactiuserx10081009hanyax10091010rrdcachedx100156[

#############

 

[root@qqdserver ~]# awk -F : '$1!~/root/{i=1;while (i<=NF) {print $i; i++}}' /etc/passwd

bin

x

1

1

bin

/bin

/sbin/nologin

daemon

x

2

2

daemon

/sbin

/sbin/nologin

adm

x

##########################

 

awk小记续_linux命令_03

 

###

 

awk小记续_linux命令_04

 

 

 

#############

awk小记续_linux命令_05

 

awk小记续_linux命令_06

######################################

 

[root@qqd237 ~]# netstat -ant |awk '$1~/tcp/ {S[$NF]++} END {for (A in S ) print A,S[A]}'

LAST_ACK 3

LISTEN 11

SYN_RECV 2

ESTABLISHED 9

FIN_WAIT1 1

FIN_WAIT2 20

CLOSING 1

TIME_WAIT 40

###############################
 

awk小记续_linux命令_07

 

#####################

 

[root@qqd237 httpd]# awk '{IP[$1]++}END {for (A in IP) print A,IP[A]}' access/2012_10_18_0532bm.com-access_log  |less

180.153.236.59 4

180.153.236.19 3

220.181.51.114 1

123.138.239.87 1

202.99.246.98 2

222.247.59.146 140

218.205.132.52 1

114.80.93.189 15

61.135.186.41 3

116.25.27.15 1

61.135.186.43 2

61.135.186.44 8

131.253.41.45 1

222.85.150.130 4

131.253.41.47 1

131.253.41.48 1

131.253.41.49 2

157.55.35.82 21

207.46.199.213 1

######################

 

awk小记续_linux命令_08

 

####################