Why Unix Rocks – cat

I got an email from a friend where the Word doc attachment was broken into 19 pieces and Base64 encoded. I started to open each file and copy out the payload, then got bored and considered a Perl script.

What’s the simplest thing?

First have a batch file:
copy p1 + p2 temp1
copy p3+temp1 temp2
copy p4+temp2 temp3
...

Nuts. I gave up typing. Too much thinking.

Create a small batch file via dir /b:
cat "Stained Glass Book StAnnsStainedGlass.docx [01_19].eml" > fred.docx
cat "Stained Glass Book StAnnsStainedGlass.docx [02_19].eml" >> fred.docx
..
cat "Stained Glass Book StAnnsStainedGlass.docx [19_19].eml" >> fred.docx

Then edit fred.docx using Scite, looking for an X-header to remove the headers. Probably could have used grep or sed, but for 19 edits, why look up the command line options?

Then run base64 -d -i fred.docx >ff.docx. The -i handles stuff I missed.

Works great. Of course, you need the Unix utils via cygwin. It should be built into Windows. Or we should just use Ubuntu

Or maybe type filename >> target would work. Whatever.

This entry was posted in Computers, howto. Bookmark the permalink.

Leave a Reply