Given a file
myfile with the following contents:
$ cat myfile foos
A hexdump of the file gives us the contents:
$ hexdump myfile 6f66 736f 000a
Currently, I can create the file by specifying the contents in ascii like this:
$ echo foos > myfile
Is it possible to create the file by giving it the exact bytes in hexadecimal rather than ascii?
$ # How can I make this work? $ echo --fake-hex-option "6f66 736f 000a" > myfile $ cat myfile foos
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:
$ cat hexfile 6f66 736f 6f66 736f ... $ some_utility hexfile > myfile $ cat myfile foosfoosfoosfoos...