I have a file like below
Total to be mailed = 1000
Coupon_name Dist_quantity Thickness Wight (grams)
gum 235 3 10
toothpaste 500 5 12
shampoo 100 7 15
Dove 800 6 8
How can i assign above input to an output file based on followign forumla.
n=rounddown[1/(dist_quantity/total mailing)]
example for 1st coupon==> 235/1000 = 0.235
1/(235/1000) = 4.255
Round down to lowest number = 4
conclusion 1 in 4 people will get 1st coupon.
if 1 person out every 4 mailout will recieve coupon then output the thickness to output file every 4th maiout line.
Output coupon1
mailout 1 (output thickness here)
mailout 2
mailout 3
mailout 4
mailout 5
mailout 6 coupon 1 (thickness)
mailout 7
mailout 8
mailout 9
mailout 10
Ideas on how to approcah writting this script will be greatly appreciated. I want to do in in perl. how will i pass the formuala to the scipt and output. etc.
Total to be mailed = 1000
Coupon_name Dist_quantity Thickness Wight (grams)
gum 235 3 10
toothpaste 500 5 12
shampoo 100 7 15
Dove 800 6 8
How can i assign above input to an output file based on followign forumla.
n=rounddown[1/(dist_quantity/total mailing)]
example for 1st coupon==> 235/1000 = 0.235
1/(235/1000) = 4.255
Round down to lowest number = 4
conclusion 1 in 4 people will get 1st coupon.
if 1 person out every 4 mailout will recieve coupon then output the thickness to output file every 4th maiout line.
Output coupon1
mailout 1 (output thickness here)
mailout 2
mailout 3
mailout 4
mailout 5
mailout 6 coupon 1 (thickness)
mailout 7
mailout 8
mailout 9
mailout 10
Ideas on how to approcah writting this script will be greatly appreciated. I want to do in in perl. how will i pass the formuala to the scipt and output. etc.