|
From: | Matthew Woehlke |
Subject: | Re: What is the opposite of 'printf'? |
Date: | Tue, 12 Dec 2006 10:06:10 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.8) Gecko/20061025 Thunderbird/1.5.0.8 Mnenhy/0.7.4.0 |
Matthew Woehlke wrote:
(Sorry this isn't exactly the right list, but this feels like a problem coreutils should solve, and I don't see gmane carrying anything better.)I am looking for a way to convert binary data to a format that 'printf' will understand (and more importantly, from which '<something> | sed 's/\\/\\\\/g' | xargs printf' will produce the same output as the input). Am I missing such a utility, or might this be an opportunity for me to write 'unprintf' for coreutils? ('od -An -c' gets close, but still needs some complex parsing if it is to round-trip.)The objective is to be able to reproduce a binary file from an 'editor friendly' shell script. I know base64 could do this, except that base64 is not portable (even to pre-6.x GNU coreutils), whereas printf is IIRC required by POSIX.
Thanks Eric and Bob for the replies. Unfortunately, as stated, the problem is that I am looking to generate an editor-friendly script (i.e. makeself is out) that can be run on arbitrary platforms (i.e. codegroup is out). And apparently uudecode is also out; my computer has man pages for it but no programs(?!). Conversely, I can't say I've run into a system yet that lacks printf.
So my original question remains... would anyone be interested in considering 'unprintf' for inclusion in coreutils? (Note: I /am/ volunteering to write and maintain it.)
-- Matthew Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
[Prev in Thread] | Current Thread | [Next in Thread] |