Skip to content
Advertisement

Copy n bytes of data x to file

How we can copy for example 10 bytes of ‘7’ to a file?

How can I generate those 10 bytes of 7?

For example for n bytes of zero I’m doing dd if=/dev/zero of=myFile bs=1 count=10.

Advertisement

Answer

You can send the zeros to stdout and translate them to 7, or what ever you like.

dd if=/dev/zero bs=1 count=10 | tr "" "7" > file.bin
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement