Update: For clarity's sake, I worded the question to ask how to write a small number of bytes to a file. In reality, I need a way to pipe a large amount of hexadecimal numbers directly into a file rather than just 3 bytes:

Although this does answer my question, it doesn't help in my situation. I have a very large input of hexadecimal numbers that I would like to pipe into a file. I will update the question with this.
–
Cory KleinNov 14 '12 at 23:40

Here's an example of how you can use dc to Print the (UCHAR_MAX+1) value of a byte:

printf %dP 104 101 121 32 116 104 101 114 101 10 |dc

...which prints...

hey there

The default input radix is 10 - decimal - but you can set it with $val i where $val is any number between 2 and 16 (note that if the current input radix is not 10 you'll have to use the current base's value for 10 to get it back - else you can always do Ai).

That's a pretty impressive 3-liner. I'd be interested if you cared to elaborate on that regex!
–
Cory KleinMar 12 at 21:33

@CoryKlein - the regex isn't really what matters - sed just inserts a P after every two not-space chars and appends the string []p to every line. It is dc that is interesting. First echo sets its input radix to 16 (so it will interpret the hex char pairs as numbers) then for every byte it reads in it Prints its (UCHAR_MAX+1) value to stdout and pops it off the stack. Try echo 8i141P12PAi97P10P16i61P0AP |dc and see what you get.
–
mikeservMar 12 at 22:04

With that, I get a\na\na, is that supposed to be what I see?
–
Cory KleinMar 12 at 23:22

@CoryKlein - yeah. It sets the input radix to octal then prints the ascii char for the octal bytes 141 and 12 - then sets it to A(10 - decimal) and prints the ascii chars for 97 and 10, then sets it to hex and prints the ascii chars for 61 and 0A. All of those char pairs are a\n.
–
mikeservMar 12 at 23:27