日志处理脚本

日志处理:

#!/bin/bash

file_name=0529
cd ./$file_name

file_list=$(ls .)

for file in $file_list
		do
				if [ -f $file ];then
								line=`cat $file | wc -l`
								first=`head -1 $file`
								last=`tail -1 $file`
								
								seed_first=`echo $first | awk -F '"send_count":' '{print $2}' | awk -F '}' '{print $1}'`
								seed_last=`echo $last | awk -F '"send_count":' '{print $2}' | awk -F '}' '{print $1}'`

								echo "sn: "${file%-*}  "line: " $line   "first: " $seed_first "seed_last: " $seed_last >> ../$file_name.txt
				fi
		done