Created
July 27, 2012 10:35
-
-
Save pooooch/3187345 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#=================================== | |
#按split分割文件,并发处理,提高效率 | |
#=================================== | |
##默认分割为3份 | |
split=3 | |
if [ $2 ]; then | |
split=$2 | |
fi | |
work_dir="/home/linyi/bp/report/xinpin" | |
if [ $1 -a -e $1 ]; then | |
cd $work_dir/temp | |
rm -rf x* | |
##计算分割几份需要的行数 | |
total=`cat $1 | wc -l` | |
pre_line=`expr $total / $split + 1` | |
split -l $pre_line $1 | |
#遍历,通过&放入后台,以此并发 | |
for name in x* | |
do | |
${work_dir}/clean.sh $name >> ${work_dir}/temp/clean.log & | |
done | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment