[alt.sources] uuencode split/join

peltz@cerl.uiuc.edu (Steve Peltz) (01/25/91)

Rather than meekly accepting the necessity of a program to combine the parts of
a split uuencoded file by skipping headers, I'll just post these two shell
scripts for splitting and joining a file. Of course, another simple way would
be to enclose each part of the split file inside a shar, but that would be
too simple. At least with this, you can join the file by uudecoding the
separate parts (letting uudecode skip the headers), then cat the resultant
files together (which is all that the uujoin script below does).

Note that uusplit doesn't test to see if the file was actually split, so
it blows up in that case.


#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  uusplit uujoin
# Wrapped by peltz@uinova on Thu Jan 24 13:19:03 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'uusplit' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'uusplit'\"
else
echo shar: Extracting \"'uusplit'\" \(206 characters\)
sed "s/^X//" >'uusplit' <<'END_OF_FILE'
X#!/bin/sh
Xuuencode $1 $1.aa | split - $1.
Xlast=$1.aa.uu
Xmv $1.aa $last
Xfor file in $1.[a-z][a-z]
Xdo
Xcat >> $last << EOF
X x
Xend
XEOF
Xlast=$file.uu
Xcat - $file > $last << EOF
Xbegin 644 $file
XEOF
Xrm $file
Xdone
END_OF_FILE
if test 206 -ne `wc -c <'uusplit'`; then
    echo shar: \"'uusplit'\" unpacked with wrong size!
fi
chmod +x 'uusplit'
# end of 'uusplit'
fi
if test -f 'uujoin' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'uujoin'\"
else
echo shar: Extracting \"'uujoin'\" \(102 characters\)
sed "s/^X//" >'uujoin' <<'END_OF_FILE'
X#!/bin/sh
Xfor file in $1.[a-z][a-z].uu
Xdo
Xuudecode $file
Xdone
Xcat $1.[a-z][a-z] > $1
Xrm $1.[a-z][a-z]
END_OF_FILE
if test 102 -ne `wc -c <'uujoin'`; then
    echo shar: \"'uujoin'\" unpacked with wrong size!
fi
chmod +x 'uujoin'
# end of 'uujoin'
fi
echo shar: End of shell archive.
exit 0
--
Steve Peltz
Internet: peltz@cerl.uiuc.edu	PLATO/NovaNET: peltz/s/cerl