dd can write repeating \0 bytes to a file very fast, but it can't write repeating arbitary strings.
Is there a bash-shell method to write repeating arbitary strings equally as fast as 'dd' (including \0 ) ?
All the suggestions I've encountered in 6 months of linux are things like printf "%${1}s" |sed -e "s/ /${2}/g", but this is painfully slow compared to dd, as shown bel402653184ow.. and sed crashes after approx 384 MB (on my box).. actually that's not bad for a single line-length :) but it did crash!
I suppose that wouldn't be an issue for 'sed', if the string contained a newline).
Speed Comparison 'dd' vs 'printf+sed'
real user sys
WRITE 384 MB: 'dd' 0m03.833s 0m00.004s 0m00.548s
WRITE 384 MB: 'printf+sed' 1m39.551s 1m34.754s 0m02.968s
# the two commands used
dd if=/dev/zero bs=1024 count=$((1024*384))
printf "%$((1024*1024*384))s" |sed -e "s/ /x/g"
I have an idea how to do this in a bash-shell script. but there's no point re-inventing the wheel :)
