2

I need to get binary files into text format. Years ago, I used uuencode/uudecode, and it was easy:

uuencode file.xls > file.txt
# Delete file.xls
# Do whatever with file.txt
# Now I need file.xls back
uudecode file.txt > file.xls

But uuencode/uudecode is not on my system, and as I look around, the yum/rpm process is ugly--this gives me the clue that maybe no one uses it any more and instead there is something more modern to do this.

I looked at xxd and hexdump but couldn't get them to do it. Could just be dumb user issues.

What can I use on Linux to do this? Would like it to be something that tends to be in the native install so I don't need to yum/rpm it if possible.

Just for your own understanding, what I'm specifically trying to do now is source control an *.xls file but the corporate tool doesn't allow *.xls in. I respect that constraint normally, but in my context, an *.xls is a configuration table for my code so It is logically like source code, but the corporate SVN trigger is physical--if it's *.xls, it gets rejected, so I'll encode it and source control the *.txt file.

Thanks!

1
  • "the yum/rpm process is ugly"? What process exactly? Installing programs that didn't come by default?
    – user1686
    May 4 '15 at 20:10
2

Got it:

xxd -p excel.xlsx > excel.xxdp
xxd -p -r excel.xxdp > recover.xlsx
diff excel.xlsx recover.xlsx
1
  • 1
    xxd is like uuencode, but not a replacement for it. May 4 '15 at 21:38
1

Those (uuencode/uudecode) are usually packaged as part of sharutils (see also its nominal website).

This question has been asked before:

0

There is a python program you can use for this.

$ python hexdump.py abc.tar  > abc.ascii

$ python hexdump.py -r abc.ascii > def.tar

$ md5sum abc.tar def.tar abc.ascii
e4733a492d5ae78d9e163a9ec808b6ae  abc.tar
e4733a492d5ae78d9e163a9ec808b6ae  def.tar
b56a0ed4d794c0cf6084ddb9e7c862f8  abc.ascii

$ ls -pla abc*
-rw-r--r--. 1 60001 60001 61514 Mar 13 16:08 abc.ascii
-rw-r--r--. 1 60001 60001 12775 Mar 13 15:33 abc.tar

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.