此脚本过滤统计后台数据并显示为HTML格式 # !/bin/sh ls -l /home/work/tools/tomcat-splitter/data/ROOT/$1 | grep $2 |sort | awk '{print $9}' >tmp.txtfile1=`cat tmp.txt | sed -n '1p'`grep $3 $file1 > $1$2$3.txtfile_input=$1$2$3'.txt'file_output=$1$2$3".html"td_str=''function create_html_head(){ echo -e " $file_input
" }function create_table_head(){ echo -e "
" }function create_td(){# if [ -e ./"$1" ]; then echo $1 td_str=`echo $1 | awk 'BEGIN{FS=" "}''{i=1; while(i<=NF) {print " "$i" | ";i++}}'` echo $td_str # fi }function create_tr(){ create_td "$1" echo -e "
$td_str
" >> $file_output}function create_table_end(){ echo -e "
" }function create_html_end(){ echo -e "" }function create_html(){ rm -rf $file_output touch $file_output create_html_head >> $file_output create_table_head >> $file_output while read line do echo $line create_tr "$line" done < $file_input create_table_end >> $file_output create_html_end >> $file_output}create_html