I have a piece of code which generates a diceware-ready list of rolls but doesn't seem ideal.
strings -n 1 rd | egrep -o "[1-6]" | tr -d "\n" | fold -w5 > dice
Since it only looks for [1-6] it takes a lot more data than it needs to to generate a list. The output looks like this:
15531
52142
13645
62143
66211
11255
11124
21166
66555
66632
11111
In an attempt to alleviate this I found the following:
echo $((0x$(head -c5 rd | xxd -ps)%6+1))
However, I have not been able to modify it to work how I want it to. As expected this only outputs 1 random dice roll. As an example it would output:
3
It doesn't go any further into the file. I'd like it to work through the entire file (like the first piece of code) and output diceware-ready lines of numbers.
Ultimately I'd like to have the program automatically replace the rolled pairs with their corresponding diceware rolls. Using the above rolls the output would change to this:
ajar
rookie
benny
uh
47th
acrid
aback
coca
8:30
96
a