Convert a file to an ascii representation that can be safely transmitted through mail gateways, posted on newsgroups, etc.
Nowadays, attaching a file to an email or a newsgroup post is often "behind the scenes" - you don't get involved in the details. And while mail programs do still have to encode attachments, they are more apt to use base64 than uuencode.
Uuencode does have its uses though. You can create a mail message with an attached file simply by:
cat file | uuencode file | mail -s "here's your file" email@example.com
Note that the resulting mail message is not the same as a message created with a MIME attachment, though many mail readers will treat it the same way and allow the recipient to save the file simply by clicking on it. See How can I send attachments from the command line?.
A uuencoded file will look something like this
begin 644 t1 @86)C9&5F9PIA8F-D969G"F%B8V1E9F<*86)C9&5F9PH` ` end
If that file were called "t1.uu", you would recreate "t1" by
Uudecode handily ignores things that don't belong to it, so t1.uu could look like this and still decode:
Here's the file you need: begin 644 t1 @86)C9&5F9PIA8F-D969G"F%B8V1E9F<*86)C9&5F9PH` ` end Just uudecode this.
You can't send multiple sets that way though; if you have multiple files, tar or cpio them and uuencode that.
Got something to add? Send me email.
More Articles by Tony Lawrence © 2011-07-05 Tony Lawrence