linux 循环处理文件夹下所有文件脚本

#!/bin/bash
function ergodic(){
for file in ` ls $1 `
do
if [ -d $1"/"$file ]
then
ergodic $1"/"$file
else
cat $1"/"$file |grep HB000A001|wc -l>>/data/hxl/out.vol
#wc -L $1"/"$file | cut -d' ' -f1 >>/data/files/middle/ack/20161010
fi
done
}
INIT_PATH="/data/files/middle/vol/20161010"
ergodic $INIT_PATH

 

另:计数Python脚本-total.py

#!/bin/python
sum = 0
while True:
try:
str = raw_input()
except:
break
num = int(str)
sum += num
print sum

 

调用:

python total.py<out.vol

 

posted @ 2016-10-12 19:01  雾火  阅读(3892)  评论(0编辑  收藏  举报