#!/bin/bash
for fileName in `ls /tmp/fastweb/`
do
echo `/bin/date` ${fileName}--start------------
`sed '1,13d' /tmp/fastweb/${fileName}|awk '{print $1,"|",$3,"|",$4}' > ${fileName}_`
`mysql -s -e "load data infile '/tmp/${fileName}_' into table test.logs_1 fields terminated by '|' "`
echo `/bin/date` ${fileName}--end--------------
for fileName in `ls /tmp/fastweb/`
do
echo `/bin/date` ${fileName}--start------------
`sed '1,13d' /tmp/fastweb/${fileName}|awk '{print $1,"|",$3,"|",$4}' > ${fileName}_`
`mysql -s -e "load data infile '/tmp/${fileName}_' into table test.logs_1 fields terminated by '|' "`
echo `/bin/date` ${fileName}--end--------------
done
本文转自cloves 51CTO博客,原文链接:http://blog.51cto.com/yeqing/1610695