split_file

Version 0.2

usage: ./split_file.sh inf [chunk_size]

Default for chunk_size, which is in megabytes, is 1024 MB (1GB).

Download links

To install from the Base64-encoded file, download the file as text and prepare cut and paste it into a terminal such as PuTTY logged into your desired host. Then run these commands, and make sure when cutting and pasting or retyping that any " character is not changed into a or a character.

cat > split_file-0.2.tar.gz.base64.txt

Paste into the window the contents of split_file-0.2.tar.gz.base64.txt, press Ctrl+D and press Enter, then retype or cut and paste these commands:

da=$(printf \\055) file=split_file$da""0.2 t=.tar.gz b=base64
openssl $b $da""d<"$file"$t.$b.txt>"$file"$t&&
tar xzvf "$file"$t&&
openssl dgst $da""sha256 "$file"{$t,$t.$b.txt,/s*,/t*}|tee sums.txt&&
(cd "$file"&&./t*)

If everything worked, it should say “Tests for split_file.sh passed.

The sums above should exactly match what is in the split_file-0.2.sums.txt file. You can compare it with this command and then cutting and pasting that file, pressing Ctrl+D, and pressing Enter:

diff sums.txt $da&&echo Checksums all match.

You can now use the utility in split_file-0.2/split_file.sh. To have it easily available, copy it to /usr/local/bin:

install -m 755 split_file-0.2/split_file.sh /usr/local/bin

Cut-and-paste installation

da=$(printf \\055) f=split_file$da""0.2 t=.tar.gz b=base64
o=$f$t.$b.txt sums=$f.sums.txt n=$da""n
echo H4sIAO1m3lgCA+1YW2/bNhT26/grTlQVTbJaN9+GpMrQtFmxAhmKxN1LHHS0RFma>$o&&
echo rctEKm67Dtgv2fve9wN3SMqJ3SZbMSTBsPFDAIn0uR/qHJ7wapGJN0m2YF3PCdzO>>$o&&
echo XcBDjEaDzq9y8dvvf3i+3x/2PLXfouP3vOEId3u+3/H8Xg+3YNC5BzRc0Bqg8yOr>>$o&&
echo yzi+ma6aoVWjYdD5b4Fv5v9q6fD0VvM/uDH/gT+6zH/Q93qY/8EIt8Az+b9zPNhy>>$o&&
echo p1nhTilPyQPYSD/ggYCeD8cYn8DzR+CP9vCv14NUiIrvue4sE2kzdaIyd1+WPD3B>>$o&&
echo AK6dIEKyIgltn0Rz/j60AzKVT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&
echo RZqwBWd/RVdRziUdFto6l41olZQ2du66SZ9B4uzqgErPkFzG/SNyXdqVP6Y6/1/r>>$o&&
echo /8nR0+fHR04e3/b8Pxz2b5z/fewNm/N/f4CF1tT/+6j/azOfHPgIaQeoH5zNfwao>>$o&&
echo cWptmjon5J/PUHKEwgnKfH4GBgYGBgYGBgYGBgYGBgYGBgYGBneGPwFqJRy0ACgA>>$o&&
echo AA==>>$o&&
echo $n "SHA256($f$t)"= 727e036ccf971c0e470c12c1a400496b717f8daa828>$sums&&
echo c9f323a90fa4008c6199e>>$sums&&
echo $n "SHA256($o)"= 312347d67ad0aa2ae0a3b7fe789d1f200f8cdabbef6f>>$sums&&
echo 839211925f253a70ce60>>$sums&&
echo $n "SHA256($f/split_file.sh)"= 6ec405314b869ea45b8d3f43b9bfd8>>$sums&&
echo 2f0d6c74f0d08dcd341cfd0d09fc55b109>>$sums&&
echo $n "SHA256($f/test$da""split_file.sh)"= db7db29e4b9ab6a399ec78>>$sums&&
echo d68fe19de1855d5b669692e46358898473a55de96f>>$sums&&
openssl $b $da""d<$f$t.$b.txt>$f$t&&tar xzvf $f$t&&
openssl dgst $da""sha256 $f{$t,$t.$b.txt,/s*,/t*}>sums.txt&&
diff sums.txt $sums&&(cd $f&&./t*)&&
echo Everything copied and tested OK.&&
install $da""m 755 $f/split_file.sh /usr/local/bin&&
echo Utility is now installed in /usr/local/bin and ready to use.

#end

Copyright notice

split_file 0.2
Copyright © 2017 Josh Rodd

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.