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.
set_P tb 09 MG 190
run 5 50000
.
.
.
.
.
set_P tb 70 MG 750
run 5 50000
--------------------
I know how to make a script which do the work if I have one running varaiable, but as you see here
I have two running variables. The first is called 'tb' and it runs from 05 to 70, say, with
a step of 1. The other is called MG and it runs the same number of steps but with a step of 10.
I know it can be done, would you please help me?
Thanks a lot,
PS.
I read a lot a bout shell scripting and I only found talks about doing one loop only. I have here two as you can see.
Another script I need is one which is capable of the following;
I have a code which gives me my results as column of numbers just like the following:
2
3
-8
9
57
5
34
.
.
.
-10
Is it possible to make a script which can take these values and put them in a table forum such that they form a second column, the y column, and get the form:
2 2
4 3
6 -8
8 9
10 57
12 5
14 34
. .
. .
. .
100 -10
the idea is that I want to add the first column, which runs in a controlled pattern (add 2 each step), to the results column so I can have a file with two columns which fits the gnuplot.
Do you mean you have a program that outputs the first set of data and you want to be able to format it without editing the first program?
you can pipe data from one program to another...
prog1 | prog2
prog1 would spit out the first set of data that would then be piped to prog2 through standard in. You can redirect input from standard in with the $< variable.
Alternatively, you could use the output from prog1 in the argv array like so:
Thanks for your answer.
I mean the program I have gives me the first column as an output. this is the colum which stands for the y-axis, say. I want to use these as a second column in a file such that the first column, which stands for the x-axis, is written just beside the column of results, the y-axis column, as in the example, so I can use a two-column file, one I added manully and the other which is generated by my program, to plot them with any drawing program.
My code produces the results in a format which is not directly a column of data, but I can make that column easily, then i should do the job I mentioned above! Any solutions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.