Re: Generating data depending upon the given size



On 11/08/10 17:51, John Kelly wrote:
On Wed, 11 Aug 2010 15:46:35 +0000, John Kelly <jak@xxxxxxxxxxxx> wrote:

/dev/urandom is better than /dev/random for junk data. Or maybe even
/dev/zero piped to hexdump. You can use a format with hexdump to
eliminate spaces in the output. I did not see a way to do that with od.

Whoops. hexdump can read /dev/zero directly, no pipe needed:

hj:~# hexdump -n 4 -v -e '/1 "%.2x"' /dev/zero
00000000

Just change the "-n 4" to the number of bytes you want.

Okay. Then I'd use a shell builtin...

printf "%0*d", 78, 0

....will print 78 zeroes.

Janis
.



Relevant Pages