Commit 680a9896 authored by yiwenshao's avatar yiwenshao

add pack

parent 4e4e5061
./mtl/final_load_low_memory localhost micro_db int_table
str_len=16
function generate_insert_int(){
head=$1
pipe=$2
count=$3
for((i=1;i<$count;i++))do
res=$head
for((j=1;j<$pipe;j++))do
cur=`./mtl/rand_str $str_len`
res="${res}('$cur'),"
done
cur=`./mtl/rand_str $str_len`
res="${res}('$cur');"
echo $res
done
}
h="INSERT INTO str_table VALUES "
generate_insert_int "$h" 3 100
function get_split(){
b=$1
e=$2
f=$3
pname=$4
sed -n "${b},${e}p" $f > ${f}_${pname}
}
if [ $# != 2 ];then
echo "should give the text name, and the num of splits"
exit
fi
base=0
filename=$1
total_line=`cat $filename | wc -l`
num_of_splits=$2
echo total_line: $total_line
step=$[ $total_line/$num_of_splits ]
echo step: $step
#get_split 1 5 text 1
cnt=1
for((;$base<$total_line;));do
echo $[ $base + 1 ] , $[ $base + $step ], cnt: $cnt
get_split $[ $base + 1 ] $[ $base + $step ] $filename $cnt
base=$[ $base + $step ]
cnt=$[ $cnt + 1 ]
done
./mtl/final_store localhost micro_db int_table
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment