View Single Post
Old 2022-05-10, 22:22   #8
pepi37
 
pepi37's Avatar
 
Dec 2011
After milion nines:)

23·3·5·13 Posts
Default

Quote:
Originally Posted by kruoli View Post
In bash:
Code:
if [ $# -ne 3 ];
then
  echo 'Usage: bash splitter.sh [in file] [out file] [number of workers]';
  exit -1;
fi;
if ls "$1."* 1> /dev/null 2>&1;
then
  echo 'Temporary files could not be created.';
  exit -2;
fi;
range=$(seq 1 $3);
if [ $? -ne 0 ];
then
  echo 'The worker count was not numerical.';
  exit -3;
fi;

for w in $range;
do
  echo "[Worker #$w]" >> "$1.tmp";
done;
cat "$1" >> "$1.tmp";
split -n r/$3 "$1.tmp" "$1.s";
cat "$1.s"* > "$2";
rm "$1."*;

Work perfect.
Now I will see can I adopt it to Win
Thanks!
pepi37 is online now   Reply With Quote