[root@mysql1 tmp]# cat test.sh
#!/bin/bash
for fileName in `ls /tmp/fastweb/`
do
echo `/bin/date` ${fileName}--start------------
ttl=`head -1 /tmp/fastweb/${fileName}|awk '{print $2}'`
`sed '1,13d' /tmp/fastweb/${fileName}|awk '{if($2=="IN"){ print $1,"|",801,"|",$3,"|",$4 }else{ print $1,"|",$2,"|",$4,"|",$5 }}' > ${fileName}_`
`mysql -s -e "load data infile '/tmp/${fileName}_' into table test.logs_1 fields terminated by '|' "`
echo `/bin/date` ${fileName}--end--------------
done
導數據2
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.