#!/bin/bash
if [ $#
ne
]; then
echo
Usage: split file size(in bytes)
exit
fi
file=$
size=$
if [ !
f $file ]; then
echo
$file doesn
t exist
exit
fi
#TODO: test if $size is a valid integer
filesize=`/bin/ls
l $file | awk
{print $
}
`
echo filesize: $filesize
let pieces=$filesize/$size
let remain=$filesize
$pieces*$size
if [ $remain
gt
]; then
let pieces=$pieces+
fi
echo pieces: $pieces
i=
while [ $i
lt $pieces ];
do
echo split: $file
$i:
dd if=$file of=$file
$i bs=$size count=
skip=$i
let i=$i+
done
echo
#!/bin/bash
> merge
echo
i=
>> merge
echo
while [ $i
lt $pieces ];
>> merge
echo
do
>> merge
echo
echo merge: $file
$i
>> merge
echo
if [ !
f $file
$i ]; then
>> merge
echo
echo merge: $file
$i missed
>> merge
echo
rm
f $rged
>> merge
echo
exit
>> merge
echo
fi
>> merge
echo
dd if=$file
$i of=$rged bs=$size count=
seek=$i
>> merge
echo
let i=$i+
>> merge
echo
done
>> merge
chmod u+x merge
From:http://tw.wingwit.com/Article/program/Oracle/201311/17694.html