#!/bin/bash
ym=`date +%y%m`
if [ -z "$1" ];then
echo "Usage: $0 logname"
exit 1
elif [ "$1" == "-p" ];then
echo "awk '{ if(\$1~/^$ym/) {y=\$1;m=\$2;print \$0;} else {print y,m,\$0}}'"
exit 0
fi
awk "{ if(\$1~/^$ym/) {y=\$1;m=\$2;print \$0;} else {print y,m,\$0}}" $1
阅读(1365) | 评论(0) | 转发(0) |