首页 > 代码库 > Linux 08

Linux 08

1

image

{printf $6" "$7" \t";if (substr($1,1,1)=="d") {printf "<dir>\t"} else {printf "\t"$5}; print "\t"$8}

ls -l --time-style=+‘%F %R‘  /etc |awk -f /home/awk/windir.awk

效果:

image

 

 

2

 

image

uptime | awk ‘{if($8 > 20 || $9 > 20|| $10 > 20) print "service httpd restart";else print "echo OK"}‘ > restart.sh

 

3.

find / -name "a*" -type f -exec ls -l {} \;|awk ‘BEGIN{sum==0;i==0} {sum=sum+$5; i++;} END{ print sum/i;}‘

image