ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi all... how could I get a table that looks like this:
Variables:
one = 01 to 20 every 01
two = 12 to xx every 12 (this value keeps its increment of 12 every time the "one" variable increases by one in this case until the last value of "one" is reached)
three = 20 to 23 every 01
The table should look like this:
one two three
01 12 20
01 12 21
01 12 22
01 12 23
01 24 20
01 24 21
01 24 22
01 24 23
01 36 20
01 36 21
01 36 22
01 36 23
02 48 20
02 48 21
02 48 22
02 48 23
02 60 20
.. .. ..
20 xx 23
I think you can see the pattern!
I've been thinking over and over but no right answer came to my mind, I tried a triple for loop but could not get it to work.
Any hint would be appreciated!
Thanks!
Last edited by conejo_perez16; 07-26-2016 at 04:34 PM.
I would add that your explanation of the fields does not follow your example data!
If we ignore column 2 for the moment, even though columns 1 and 3 start with different numbers your incremental information was the same:
one = 01 to 20 every 01
three = 20 to 23 every 01
Yet your example shows:
Code:
one two three
01 12 20
01 12 21
01 12 22
01 12 23
01 24 20
01 24 21
01 24 22
01 24 23
Here we can clearly see column three increasing by 1 each time until the threshold of 23 is reached, yet column one has not increased at all for any of the 8 rows shown.
So either you need to provide a better explanation or your current example needs to be altered.
hi all... how could I get a table that looks like this:
Variables:
one = 01 to 20 every 01
two = 12 to 36 every 12 (this value keeps incrementin by 12 every time the "one"
variable increments
three = 20 to 23 every 01
column 2 has values greater than 36 in your example
Thanks for pointing out my mistake grail and keefaz, I just modified the original post, In fact the problem is that every time the variable "one" increments i want to keep the variable "two" increasing by 12 until the last value of "one" is reached
Im creating a little script, in a few minutes i will post it so you can see where I have the problem!
Variables:
one = 01 to 20 every 01
two = 12 to xx every 12 (this value keeps its increment of 12 every time the "one" variable increases by one in this case until the last value of "one" is reached)
three = 20 to 23 every 01
My code should be consistent with that!
Anyway you are right the example table is not consistent with these requirements. So I supposed the table was wrong. Is my interpretation correct?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.