Thanks for your prompt response. I have Cygwin and I was unable to execute the ruby command.
Do you have an "awk" script version that I can use instead of this script?
If you mean permutations, rather than combinations, this can be done relatively easily using recursion in a shell that has local variables:
#!/bin/ksh
function perm {
typeset p=$1 s=$2 i
for i in "${NR[@]}"
do
if [ $p -eq 1 ]; then
printf "%s%s=\n" "$s" "$i"
else
perm $((p-1)) "$s$i+"
fi
done
}
while read nr; do
NR[$((i++))]=$nr
done < infile
perm ${#NR[@]}
The trouble is the exponential increase in the time required with increasing numbers
The shell script of awk that you 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 numbers.
I would appreciate it you can help me with the awk script of combination.