kleucht has asked for the wisdom of the Perl Monks concerning the following question:

This is OFF TOPIC.

I have accounts on two completely different LINUX systems, and I cannot find the "uuencode" program on either system. Is there a new command line utility that I should know about? One of the two systems is a RedHat system that I installed myself a few weeks ago, so I know that I never deleted the file.

I'm trying to encode a binary file into plain text for emailing off the server.

Thanks for your help with my off topic problem,
Kurt

Updated: I never deleted the file

Replies are listed 'Best First'.
Re: OT: What happened to uuencode?
by perrin (Chancellor) on Jan 13, 2004 at 02:52 UTC
Re: OT: What happened to uuencode?
by Roger (Parson) on Jan 13, 2004 at 02:57 UTC
    Well, not entirely off topic though, here's a Perl solution - puuencode

    Usage: puuencode inputfile as_outputfile

Re: OT: What happened to uuencode?
by BrowserUk (Patriarch) on Jan 13, 2004 at 02:52 UTC

    If it helps. this one-liner will do roughly the same thing as uuencode I think.

    perl -ple"BEGIN{ $/=\32} $_ = pack 'u*', $_" file

    Update: Apparently it should be

    perl -ple"BEGIN{ $/=\45} $_ = pack 'u', $_" file

    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!

Re: OT: What happened to uuencode?
by kutsu (Priest) on Jan 13, 2004 at 02:39 UTC

    locate uuencode

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

      Results:
      [kurt@amber miscFiles]$ locate uuencode /usr/share/man/ja/man1/uuencode.1.gz /usr/share/man/ja/man5/uuencode.5.gz /usr/share/man/pl/man5/uuencode.5.gz /usr/local/directadmin/customapache/apache_1.3.28/icons/uuencoded.gif /usr/local/directadmin/customapache/apache_1.3.28/icons/uuencoded.png /var/www/icons/uuencoded.gif /var/www/icons/uuencoded.png [kurt@amber miscFiles]$
      Looks like there are some man pages on the server, but not an executable.

        Besides the fact that this is horribly off-topic, the question doesn't really make sense neither ;)

        Linux doesn't have a "minimal set of tools" that should be on each system. You -as r00t- may delete whatever you see fit. Apparantly, your sysadmin did indeed delete the binary, for there seem to be manual pages around. I've checked two systems (Slack and Debian) and the binary resides in /usr/bin/ on both machines I've checked.

        So, either install it (tarball/.deb/.rpm/.whatever), or -to make this a lil' more on topic- create a script that does the same, using Convert::UU :)

        Update: Edited (<strike>) to fit the completely altered root node ...

        --
        b10m
Re: OT: What happened to uuencode?
by zentara (Cardinal) on Jan 15, 2004 at 19:11 UTC
    I tried BrowserUK's 1-liner, but it didn't work right for me. I had to set $/=undef. This is what I came up with:

    To encode:

    #!/bin/sh perl -i.orig -ple'BEGIN{ $/=undef} $_ = pack 'u', $_' $1
    To decode:
    #!/bin/sh perl -i.uu -ple'BEGIN{ $/=undef} $_ = unpack 'u', $_' $1

      Tried to improve it by adding headers:

      #!/bin/sh PATHFILE=$1 SHORTFILE=`basename "$PATHFILE"` perl -i.orig -ple 'BEGIN{$/=undef} $_= "begin 600 $ENV{SHORTFILE}\n". +(pack 'u', $_)."`\nend" if $_' $1
      It can be enhanced by checking the file permissions and setting those too, instead of the hardcoded 600