...
I try to get the combination of 6 numbers from (1-60) using any script.
Any script that can help me to fix this ...
EG: The output should be like that different possibilities from 1-60...
1) 1 3 15 29 30 42
2) 4 5 6 31 44 60
like the above ... Hereas, I need all the possibilities of this combination.
You haven't mentioned if the a number can repeat in the individual 6 slots. If a number cannot repeat, can a combination of the 6 numbers repeat? If neither of the above two things could happen, then we are looking at combinations of n numbers taken r at a time.
Case 1 - A number can repeat in all the slots. So, we have cases like:
Case 2 - A number cannot repeat but a combination can repeat, i.e. we are looking at permutations of n numbers taken r at a time. As an example, we could have cases like the following:
1 2 3 4 5 6
...
2 1 3 4 5 6
...
3 1 2 4 5 6
...
The numbers don't repeat in the individual slots, but permutations do repeat. Altogether, the 6 numbers are the same in the example above. In case of permutations, order is important.
For such an scenario, we have 60! / (60 - 6)! = 60! / 54! = 3.6 * 10^10 (about 36 billion) possibilities.
Case 3 - The numbers don't repeat and the combinations don't repeat either. These are combinations of n numbers taken r at a time. Examples:
In case of combinations, order is not important.
There are 60!/ (54! * 6!) = 5.0 * 10^7 (about 50 million) such possiblities.
The first two cases should be easy to implement. I've posted a program to generate all possible combinations of n numbers taken r at a time. It's in Perl, in case that is an option.
Hi,
I need to find the number of tab delimiters in the first line of a file.So using
word=`head -1 files.txt`
I have extracted the first line of file into a variable word.It has 20 tab delimted columns.So can anyone help me in finding the number of delimiters?
I am using csh and I am a... (5 Replies)
Hi friends
I have 100 files in my directory. Each file look like this..
Temp1 Temp2 Temp3
MAS 1 2 3
MAS 4 5 6
MAS 7 8 9
Delhi 10 11 12
Delhi 13 14 15
Delhi 16 17 ... (4 Replies)
Hi Friends,
In continuation to my earlier post
https://www.unix.com/shell-programming-scripting/99166-script-find-average-given-column-also-specified-number-rows.html
I am extending my problem as follows.
Input:
Column1 Column2
MAS 1
MAS 4 ... (2 Replies)
I am writing a bash script to find out all the files in a directory which are empty. I am running into multiple issues. I will really appreciate if someone can please help me.
#!/bin/bash
DATE=$(date +%m%d%y)
TIME=$(date +%H%M)
DIR="/home/statsetl/input/civil/test"
... (1 Reply)
I need a Shell script which take two inputs which are
1) main directory where it has to search and
2) pattern to search within main directory all files (.c and .h files)
It has to print number of pattern found in main directory & each sub directory.
main dir --> Total pattern found = 5
|... (3 Replies)
Hi
I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field.
The source file is pipe delimited and looks something like
1|net|ABC Letr1|1530|||
1|net|EXP_1040 ABC|1121|||
1|net|EXP_TG1224|1122|||
1|net|R_North|1123|||... (5 Replies)