lundi 2 février 2015

save random numbers generated with awk in a variable

This code is very helpful awk in bash script for generating random numbers.



awk 'BEGIN {
# seed
srand()
for (i=1;i<=10;i++){
print int(1 + rand() * 1000)
}
}'


But it just print random numbers. I whould like save random number(s) in variable(s) and after awk ends, use them. Is it possible? How?





Aucun commentaire:

Enregistrer un commentaire