## Combination of numbers

Combination of numbers
# 1
02-11-2011
Combination of numbers

Hello Group,

I have a file of data that contain
1
2
3
4
5

I request you help with a shell script for generate all posible combination of these numbers with the following output:

Example:
1 + 2 + 3 + 4 + 5 =
2 + 2 + 3 + 4 + 5 =
3 + 2 + 3 + 4 + 5 =

Carlos
 csierra View Public Profile for csierra Find all posts by csierra
# 2
02-12-2011
Ruby(1.9.1+)
This User Gave Thanks to kurumi For This Post:
 kurumi View Public Profile for kurumi Find all posts by kurumi
# 3
02-12-2011
Hello kurumi / Forum,

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?

I really appreciate it your help

Carlos
 csierra View Public Profile for csierra Find all posts by csierra
# 4
02-13-2011
try:
This User Gave Thanks to yinyuemi For This Post:
 yinyuemi View Public Profile for yinyuemi Find all posts by yinyuemi
# 5
02-13-2011
If you mean permutations, rather than combinations, this can be done relatively easily using recursion in a shell that has local variables:
The trouble is the exponential increase in the time required with increasing numbers

With awk:
So I think this kind of exercise is best left to a general programming language

Last edited by Scrutinizer; 02-13-2011 at 08:27 AM..
This User Gave Thanks to Scrutinizer For This Post:
 Scrutinizer View Public Profile for Scrutinizer Find all posts by Scrutinizer
# 6
02-13-2011
Quote:
Example:
1 + 2 + 3 + 4 + 5 =
2 + 2 + 3 + 4 + 5 =
3 + 2 + 3 + 4 + 5 =
Inho this not an example of combinations or an example of permutations.
What is the process?
 methyl View Public Profile for methyl Find all posts by methyl
# 7
02-13-2011
My understand is, this is homework again.
 rdcwayx View Public Profile for rdcwayx Find all posts by rdcwayx

## Kill -9 -1 combination

Good morning, In a Production environment ive seen this command that kills processes kill -9 -1 Because i am in a production environmet i can not execute this comamnd, so i would like to know what is the difference for the conventional kill -9 PID ? Thanks a lot

## Combination of 6 nos

Hi folks, I have a numbers from 1-100 and from these nos I have 30 numbers.. From this 30 nos, I have to generate a combination of 6 nos... this 30 numbers will range from 1-100... ( FYI: This is not a lottery game - just kidding) ... I am trying out this in a shell script.. any ideas ?

## 6 digits combination

Is there any program that can create 6 digit numbers with: (DIGIT_1)+(DIGIT_2)+(DIGIT_3)+(DIGIT_4)+(DIGIT_5)+(DIGIT_6)=10 Any perl or C also can. Anyone can help me? Thank you

#####

## the smallest number from 90% of highest numbers from all numbers in file

Hello All, I am having problem to find what is the smallest number from 90% of highest numbers from all numbers in file. I am having file with thousands of lines and hundreds of columns. I am familiar mainly with bash but I am open to whatever suggestion witch will lead to the solutions. If I...

## Escape and combination

Hi I have 2 files like: file1 a 12 b 1 a 3 file2 a 9 c 0 a 8 and i would like to get a 12 a 9 a 3 a 8 i can do it with grep and paste with 3 lines. I tried to combine using:

## read numbers from file and output which numbers belongs to which range

Howdy experts, We have some ranges of number which belongs to particual group as below. GroupNo StartRange EndRange Group0125 935300 935399 Group2006 935400 935476 937430 937459 Group0324 935477 935549 ...

## combination of two commands

I want to show a output like this Lee Ballancore PID TTY TIME CMD 31799 pts/3 00:00:00 vim 31866 pts/3 00:00:00 vim 2495 pts/7 00:00:00 vim 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps Alistairr Rutherford PID TTY TIME CMD 8368 pts/0 00:00:00 vim 9544 pts/2 00:00:00 ps ...

## Combination Of commands

Hello All, I just wanted to know what are the different ways of using commands in combination. The most common one which i know is using pipes. Also grouping is also done like ( ls; date) where output of both the commands is displayed. Are there any other ways of combining various...

## Partition combination

Hi all I've got MacOSX server which is a UNIX based system. I've got 2 partiontion an I like to make just one partition on he disk without loosing any data on part1. Is there a way to do that kind of thing in UNIX or do I have to format everything and put up the system again? Thanx for reading...