自己寫的檔案拆分
cd /product1/port/ocs_subscriber_import/src/local
filerowcount=0
for filename in `ls -l $| awk ''`
donewfilenameleft=$
filerowcount=`cat -n $filename |wc -l`
temp=`expr $filerowcount \% 500000`
echo "tmp=$"
temp1=`expr $filerowcount / 500000`
if [ $temp -gt 0 ] ; then
temp1=`expr $temp1 + 1`
fifile_seq=1;
hrow=500000;
echo "temp1=$"
while [ $file_seq -le $temp1 ]
donewfilenameleft="$_$.unl"
if [ `expr $filerowcount-$hrow` -ge $hrow ]; then
head -$hrow | tail -500000 >$newfilenameleft
else
echo "---xx"
if [ $filerowcount -le $hrow ] ; then
n=$filerowcount
else
n=`expr $filerowcount-$hrow`
fi echo "n=$, hrow=$"
head -$hrow | tail -$n >$newfilenameleft
#這行有問題
fifile_seq=`expr $file_seq+1`
hrow=`expr $hrow+500000`
done
done
這實際上等同於:
split -l 500000 gxalluserinfo_v_20120704_101_000022.unl gxalluserinfo_v_20120704_101_000022.unl.
例項-----------------------------
ftphost="130.51.10.99"
username="***xx"
password="******x"
ld=$(perl -e "use posix qw(strftime); print strftime '%y%m%d' , localtime( time()-3600*24*1) ")
echo $ld
vfile="gxalluserinfo_v_$_*.unl"
bfile="gxyestacctbal_v_$_*.unl"
localpath="/product1/port/bin/ocs_subscriber_import/local"
localbackpath="/product1/port/bin/ocs_subscriber_import/back/"
curpath="/product1/port/bin/ocs_subscriber_import/"
#取gxyestacctbal_v
bal_v_backpath="/data/jingfen/gxyestacctbal/backup/"
bal_v_path="/data/jingfen/"
#bal_v_backpath="/product1/interf/ocs_subscriber_import/src/back/"
#bal_v_path="/product1/interf/ocs_subscriber_import/src/back/"
ftp -i -n $ftphost<
done
echo ""
echo ""
echo ""
#取gxalluserinfo_v
info_v_backpath="/data/jingfen/gxalluserinfo_v/backup/"
info_v_path="/data/jingfen/"
#info_v_backpath="/product1/interf/ocs_subscriber_import/src/back/"
#info_v_path="/product1/interf/ocs_subscriber_import/src/back/"
ftp -i -n $ftphostmv $ $
ftp -i -n $ftphost<
done
cd $
for filename in `ls -l * | awk ''`
docd $
nohup ./ocs_subscriber_import gxalluserinfo_v $filename >nohup.out &
done
CSV檔案拆分 行拆分
先要把csv文件儲存為utf 8格式 import os.path import osimport csvimport rewith open email.csv w newline encoding utf 8 as csvfile writer csv.writer csvfile with o...
大檔案拆分
fp e logtest u ex160314.log 原檔名稱 fname e logtest u ex160314 新檔名稱 fsize 1024 1024 1mb,定義每個新檔案的大小 num 1 新檔名後 1 sum 0 每個新檔案的當前大小 with open fp,rb as fo fo...
整數拆分問題
問題 對於1個正整數n,將其拆分成幾個正整數的和,如何拆分可使得其乘積最大?csdn使用者pathuang68給出的結論是 如果不在乎是否為整數的話,那麼把每份平均分為e 2.71828459045.時,所得到的乘積是最大的,如果要是整數的話,那麼就選盡可能地靠近e的整數即可,比如3。具體證明請參見...