shell - awk脚本一例
awk脚本一例
2004-04-23 15:18 pm来自:Linux文档
现载:Www.8s8s.coM
地址:无名
#!/usr/bin/awk -f
{ if ($0 != "ERROR*" || error_line != "ERROR*")
print $0 }
{ error_line=$0 }
#!/usr/bin/awk -f
{ if ($0 == "ERROR*" && error_line == "ERROR*")
next;
error_line=$0; print }
#!/usr/bin/awk -f
BEGIN {temp=0}
{if(temp!=0) print}
{temp=index($0,"PID")}
#! /bin/sh
awk -F, '{
print $4 "," $0
}' $* |
sort |
awk -F, '
$1 == LastState {
print " " $2
}
$1 != LastState {
LastState = $1
print $1
print " " $2
}'
year=`echo $1|cut -c1-4`
month=`echo $1|cut -c5-6`
day=`echo $1|cut -c7-8`
b=`cal $month $year|wc -l`
cal $month $year |
awk '{ for (i=1; i<=NF; i++)
{
if ($i == '"$day"')
{
if (NR=='"$b"'-1)
{
print i-1
}
else
{
print 7-NF+i-1
}
}
}
}'