Linux双色球彩票脚本

#!/bin/bash

str=
array=($str)

luck(){
seq 33 > tmp.txt
for i in `seq 6`
do
Random_RED=$[$RANDOM%$[32-$i]+1]
array[$i]=`sed -n "$Random_RED p" tmp.txt`
sed -i "$Random_RED"d tmp.txt
done
#echo -n ${array[@]}" ";
echo -n -e "\e[31m${array[@]}\e[0m" "";
Random_BLUE=`echo $RANDOM%15+1 |bc`
ab=`seq 16 | sed -n "$Random_BLUE p"`
echo -e "\e[34m${ab}\e[0m"
}

############start###########

read -p "你想要多少注:" COUNT
for j in `seq $COUNT`
do
luck
done
unset rockroll


-----------------------------------------
用命令截取出现相同次数的组合
# cat caipiao.txt |sort -n|awk '{print $1,$2,$3,$4,$5,$6,$7}'|uniq -d



-----------------------------------------
另外一种
rockroll=$(awk 'BEGIN{for(i=1;i<=33;i++){if(i<=16)blue[i]=i;red[i]=i}srand();for(j=1;j<=1000;j++){if(j==1){printf blue[int(rand()*16)+1]" ";continue}v=int(rand()*33)+1;if(!a[v]){n++;a[v]=1;b[n]=v;if(n==6)break}}for(k=1;k<=6;k++)printf red[b[k]]" "}');
echo -e "\e[31m${rockroll#[0-9]* }\e[0m\e[34m${rockroll%% *}\e[0m" >>/caipiao.txt

你可能感兴趣的:(linux)