It is currently Tue, 30 Nov 2021 17:16:23 GMT



 
Author Message
 Processing an compressed,uuencoded file
Hi,

I would like to know if there exists a script/program which can do the
following things:

(1) Take a ascii/binary file, compress it, uuencode it, and then split it into
    parts which are <= 1000 lines in length. (I have seen that files in
    alt.binaries.pictures.{*filter*}a are of similar nature, thus the posting to
    its discussion group)

(2) Do exactly the reverse of the above. From the parts construct the whole.

Any help would be appreciated.

Please reply by e-mail
Sridhar



 Mon, 21 Aug 1995 01:08:04 GMT   
 Processing an compressed,uuencoded file
|> Hi,
|>
|> I would like to know if there exists a script/program which can do the
|> following things:
|>
|> (1) Take a ascii/binary file, compress it, uuencode it, and then split it into
|>     parts which are <= 1000 lines in length. (I have seen that files in
|>     alt.binaries.pictures.{*filter*}a are of similar nature, thus the posting to
|>     its discussion group)
|>
|> (2) Do exactly the reverse of the above. From the parts construct the whole.
|>
|> Any help would be appreciated.
|>
|> Please reply by e-mail
|> Sridhar
What do you think about

#csh
compress -c $1 | uuencode $1:r | split -$2
#usage: splitter <file_to_compress_and_uuencode_and_split> <linecount>

--
+----------------------------------------------------------------------------+
| Thomas Planke                           Pla...@Systemtechnik.TU-Ilmenau.DE |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
| Technical University Ilmenau                       Phone: +49 3677/69-1465 |
| Dept. of Automation and Systems Engineering        Fax:   +49 3677/69-1446 |
| PF 327,Am Ehrenberg,D-O6300 Ilmenau,Germany                                |
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -|
|                             (PacketRadio: DL5...@DB0RSV.DEU.EU ) ex: Y32JK |
+----------------------------------------------------------------------------+



 Mon, 21 Aug 1995 16:41:10 GMT   
 Processing an compressed,uuencoded file
: Hi,

: I would like to know if there exists a script/program which can do the
: following things:

: (1) Take a ascii/binary file, compress it, uuencode it, and then split it into
:     parts which are <= 1000 lines in length. (I have seen that files in
:     alt.binaries.pictures.{*filter*}a are of similar nature, thus the posting to
:     its discussion group)

: (2) Do exactly the reverse of the above. From the parts construct the whole.

Included here are two scripts which I use a lot, called "mailpackage" and
"getpackage".  It assumes you are going to mail out the collection of
pieces, and then it destroys them.  It should be easily modified to save
the pieces somewhere instead of mailing them and destroying them.

There have been many different attempts to provide this kind of
functionality.  I'm sure any source archive will have multiple versions of
this sort of thing.

-------------mailpackage: cut here----------------
#! /bin/csh -f
#
#   mailpackage
#
#   This script packages up a list of a files or directories as a uuencoded
#   compressed tar file.  It then splits that file up into 1000 line blocks
#   (the default for "split") and mails each file with an appropriate subject
#   line off to the indicated mailing address.
#

set progname="$0"
set packname="$1"
set mailaddr="$2"

if ("$packname" == "" || "$mailaddr" == "") then
    echo Usage\: $progname:t packagename mailaddress filelist
    exit(1)
endif

shift;shift

if ("$*" == "") then
    echo Usage\: $progname:t packagename mailaddress filelist
    exit(1)
endif

set filelist="$*"
#   Generate the files.  Run tar on the list of files and directories, pass
#   that output to compress, pass that output to uuencode, pass that output to
#   split, which will generate a list of files beginning with "x".

set curdir=`pwd`
mkdir /tmp/$$pdir
cd /tmp/$$pdir
set tarcmd="tar cvf -"
foreach fn ($filelist)
    set tarcmd="$tarcmd -C $curdir $fn"
    echo $tarcmd
end
$tarcmd | compress -c | uuencode $packname.tar.Z | split -500
#   For each "x*" file, initialize a temporary file with a subject line,
#   then put in the x* file, and then pipe that to /bin/mail to the indicated
#   addressee.

set filenum=1
set tfiles=`/bin/ls x* | wc -l`

if ($tfiles != 1) then
    set plural="s"
else
    set plural=""
endif

echo Mailing $tfiles piece$plural.

foreach fn (`/bin/ls x*`)
    echo "Subject: Package '$packname', Part $filenum/$tfiles" > /tmp/$$mtext
    echo "Save all pieces into $packname.tar.Z.uu, then run 'getpackage $packname.tar.Z.uu'." >> /tmp/$$mtext
    echo "-------------cut here---------------" >> /tmp/$$mtext
    cat $fn >> /tmp/$$mtext
    echo "-------------cut here---------------" >> /tmp/$$mtext
    cat /tmp/$$mtext | /bin/mail $mailaddr
    echo Sent piece $filenum.
    @ filenum++
end

#   Get rid of the temporary files.

cd $curdir

/bin/rm -rf /tmp/$packname.tar.Z
/bin/rm -rf /tmp/$$mtext
/bin/rm -rf /tmp/$$pdir
-------------mailpackage: cut here----------------

-------------getpackage: cut here----------------
#! /bin/csh -f
#
#   Unpack a package that was obtained from "mailpackage".
#

set progname="$0"
set fname="$1"
if ( ! -f "$fname") then
    echo "Usage: $progname:t filename"
    exit(1)
endif

#   Remove the text outside of the "---cut here---" markers.

set awkfile=/tmp/$$awkfile
cat > $awkfile << 'IMHERE'
BEGIN {
    FALSE       = 0;
    TRUE        = 1;
    pflag       = FALSE;

/---cut here---/        {
                            pflag   = (pflag * -1) + 1;next;
                        }

{
    if (pflag)
    {
        print $0
    }
'IMHERE'

awk -f $awkfile $fname > /tmp/$$fp

if ( -z /tmp/$$fp) then
    /bin/cp $fname /tmp/$$gp
else
    /bin/cp /tmp/$$fp /tmp/$$gp
endif

/bin/rm -f $fname
/bin/rm -f /tmp/$$fp
/bin/rm -f $awkfile

uudecode /tmp/$$gp

set fname=$fname:r
/bin/chmod +rw $fname
uncompress $fname

set fname=$fname:r
tar xvf $fname

/bin/rm -f $fname
/bin/rm -f /tmp/$$gp
-------------getpackage: cut here----------------

-- David M. Karr Sierra Geophysics, Inc.  ARPA: dk...@sierra.com, UUNET:
uunet!sgihbtn!dkarr Phone: (206) 822-5200 (x377)



 Wed, 23 Aug 1995 04:49:14 GMT   
 
   [ 3 post ] 

Similar Threads

1. Looking for uuencode/uudecode & compress/uncompress

2. tar, compress, uuencode

3. cu, compress and uuencode; data loss

4. cu, uuencode, compress - data corruption and loss

5. compressing on the fly: father process seems to end before popened compress

6. Real file stats for file on a compressed file system

7. compress one large file into several smaller files?


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software