六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 53|回复: 0

[linux]写的一个服务器数据过滤HTML脚本

[复制链接]

升级  73%

127

主题

127

主题

127

主题

举人

Rank: 3Rank: 3

积分
419
 楼主| 发表于 2013-2-7 16:43:32 | 显示全部楼层 |阅读模式
此脚本过滤统计后台数据并显示为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 "<html>          <body>              <h1>$file_input</h1>"  }function create_table_head(){    echo -e "<table border="1">"  }function create_td(){#    if [ -e ./"$1" ]; then          echo $1          td_str=`echo $1 | awk 'BEGIN{FS=" "}''{i=1; while(i<=NF) {print "<td>"$i"</td>";i++}}'`        echo $td_str  #    fi  }function create_tr(){    create_td "$1"    echo -e "<tr>          $td_str      </tr>" >> $file_output}function create_table_end(){    echo -e "</table>"  }function create_html_end(){    echo -e "</body></html>"  }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
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表