So, i made a simple lottery number generator like this:
for i in `seq 10`; do seq 1 35 | shuf -n 7 | sort -g | tr '\n' ' ' ;echo; done
i've file with winning numbers:
Eg:
1 10 15 20 25 30 35
2 6 10 14 18 22 26
My problem here is how to compare or check if my generated numbers are match or i won something. To get some cash i need at least four numbers to match out of seven.
Do you have any idea how to create script for this?
Assume if I have the shuffled numbers from 1 to 35 and I don't want to check all the number from 1-35, whereas, I need to check the number randomly on my own.
How can this be achieved.
The script shown in post #2 on this thread only checks for numbers as defined by PuLPi's posted lottery number generator (7 randomly picked numbers, not all 35). The script also generates the "my_numbers" file the same way (7 randomly picked numbers but can be more or less numbers). The input of the "my_numbers" can be change as needed. If the numbers are to be input manually then a prompt can be used to read the numbers (on a loop if entered one by one) or the numbers can be read from an existing file.
1) Assume the lottery have numbers from 1-50.
2) Out of this 50 numbers, I am going to pick up only 35 numbers randomly.
3) so, my total numbers would be 35 numbers shuffled from [1-50] nos.
[eg: 1,4,6,7,11,30,32,40,46,49]
4) I have list of winning numbers in [my_number.txt] file.
5) Now, the script should check within my 35 numbers comparing the file [my_number.txt] and should give the results .. The result number should be 6 nos.
[eg: 1 6 30 32 46 49 ]