Skip to main content
You need the "0x" prefix, and for GNU awk POSIXLY_CORRECT for hex numbers to be understood.
Source Link
Stéphane Chazelas
  • 584.5k
  • 96
  • 1.1k
  • 1.7k

Maybe the UUID (on Linux) can be used to retrieve the random number

> cat /proc/sys/kernel/random/uuid

cdd52826-327d-4355-9737-895f58ad11b4

$ cat /proc/sys/kernel/random/uuid
cdd52826-327d-4355-9737-895f58ad11b4

To get the random number between 70 and 100

cat /proc/sys/kernel/random/uuid | cut -f5 -d "-" | awk '{print $1%30+70}'

POSIXLY_CORRECT=1 awk -F - '{print(("0x"$1) % 30 + 70)}
   ' /proc/sys/kernel/random/uuid

Maybe the UUID can be used to retrieve the random number

> cat /proc/sys/kernel/random/uuid

cdd52826-327d-4355-9737-895f58ad11b4

To get the random number between 70 and 100

cat /proc/sys/kernel/random/uuid | cut -f5 -d "-" | awk '{print $1%30+70}'

Maybe the UUID (on Linux) can be used to retrieve the random number

$ cat /proc/sys/kernel/random/uuid
cdd52826-327d-4355-9737-895f58ad11b4

To get the random number between 70 and 100

POSIXLY_CORRECT=1 awk -F - '{print(("0x"$1) % 30 + 70)}
   ' /proc/sys/kernel/random/uuid
Source Link
zangw
  • 341
  • 4
  • 5

Maybe the UUID can be used to retrieve the random number

> cat /proc/sys/kernel/random/uuid

cdd52826-327d-4355-9737-895f58ad11b4

To get the random number between 70 and 100

cat /proc/sys/kernel/random/uuid | cut -f5 -d "-" | awk '{print $1%30+70}'