Hello Scrutinizer / Group ,
The shell script of awk that Scrutinizer made calculate all possible permutations in this case 3125 (5 numbers) but i want to have only the 126 possible combination. For now it does not matter the specific order of the combination numbers.
I would appreciate it you can help me with the awk script of combination.
Regards,
Carlos S
infile
1
2
3
4
5
Output, example
1+2+3+4+5
1+1+3+4+5
2+2+3+4+5
1+2+3+4+4
....
....
....
----------------------------------------------------------------
awk 'function perm(p,s, i) {
for(i=1;i<=n;i++)
if(p==1)
printf "%s%s=\n\n",s,A
else
perm(p-1,s A" + ")
}
{
A[++n]=$1
}
END{
perm(n)
}' infile