looping and saving output of each line separately


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting looping and saving output of each line separately
# 8  
Old 07-05-2012
Smilie

We cannot guess what it's doing until you actually show us, especially when your program and your explanation appear to contradict each other.

Show us -- word for word, letter for letter, keystroke for keystroke -- how you'd run that program manually, to input one value, and get one result back. Use screenshots if you have to, but we need to see how it's used. It's not enough to know that it "can work" somehow, when all you've given us is a program which doesn't.
# 9  
Old 07-05-2012
Quote:
just created a file and named it perm. It is the content of the file that is important because it contains a program we use in research.
The separate script called perm adds an unwanted level of complexity to the main script because we now have to pass parameters to the other script and receive the results.
This is one of those posts where we would rather see the the problem than the solution.
In UK we have a saying, KISS.
# 10  
Old 07-05-2012
I don't know what you mean by the UK comment but I hope it is not derogatory. The most important thing which is what I need to run is the itgen............I created perm just to save that program. This is an animal breeder's took kit that is preprogrammed to run that way. what it does is to iterate for 500 rounds-r rhs is the name of the file on the right hand side, -n con is another file and -b beta is the answer I am looking for. It is like this con*beta=rhs therefore, beta=con-1*rhs. So each line in file odon will pass through this program and beta will be produced. Unless I can create a script that can produce beta for each line and save it like beta0, beta1 etc, then I will have to manually do it myself. This is the script I tried for just one line:
while read line
do ./perm
done < odon #note that the file odon has one line 12 1 1 so only beta for the line will be produced
# 11  
Old 07-05-2012
(KISS = Keep it Simple)

Ps. I'll leave you to work out how to use code tags and how to lay out a post so that non-specialists in your field can understand the post. No offence intended, but when I last looked post #10 was too difficult to understand.

Last edited by methyl; 07-05-2012 at 05:38 PM.. Reason: typo
# 12  
Old 07-05-2012
Quote:
Originally Posted by Corona688
Show us -- word for word, letter for letter, keystroke for keystroke -- how you'd run that program manually, to input one value, and get one result back. Use screenshots if you have to, but we need to see how it's used.
You've given a third explanation now; partially contradicting the other two before it. I'm less sure which of your three partial explanations to believe than ever.

Don't tell us how it's used in words, just show us what keys you hit and what the program puts back out to terminal and/or file. Show a working example of you using it once, not in a loop, with one value. Show what you type in. Show what you get out.

Show us how you'd run that program manually, putting one value in, getting one value out. Use screenshots if you have to, but show us!.

Don't show us a script which doesn't do what you want. Obviously that won't tell us what you do want -- it's wrong, but in what way is it wrong? We can't know the way to run it successfully without seeing you run the program successfully.
# 13  
Old 07-05-2012
If I knew what to do, don't you think I would have done it? That's why I am asking for input, I am about 1 month into programing. Thanks
# 14  
Old 07-05-2012
I am not asking you to write the script.

You apparently know how to use this 'perm' program for single items but don't know how to put it in a loop.

We don't know how to run this program yet, not even for single items. All we have is your broken loop which doesn't work. We can't guess which of 10,000 possible variations of parameters and piping 'perm' actually expects, and your explanations seem a bit muddled.

I am asking you to run 'perm' in your terminal once, cat its output files if any, hit your 'print screen' key, and attach the screenshot. That will unambiguously show how your program is used on a single item, and we can build a loop around it from there.

Last edited by Corona688; 07-05-2012 at 05:50 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Looping through input/output

Hi, I've got a directory of about 6000 txt files that look like this: a b c d e f g h k l m n I need to execute a command on them to combine them and, in the end, have one big file with all the needed columns taken form all the 6000 files. I've got the "combining" program, but my problem... (26 Replies)
Discussion started by: zajtat
26 Replies

2. Shell Programming and Scripting

sed command is saving output as blank file

Hi, I am working on a script where I am adding adding colors to few of the info in the output. Now , after that is done , I see colour codes in log files which I don't want to see.:mad::mad::mad::mad: So , I tried using sed command in script as below which gives me o/p (new.log) as blank file... (7 Replies)
Discussion started by: Dream4649
7 Replies

3. Shell Programming and Scripting

Saving files with file name as output

Hi, i need help with a file creation of an output program. I've got a program that with #find creates an output for each files in a directory. If i give this command : -o spec$(date -u +%Y%m%dt%H%M) it creates just one file, overwriting all the others since it is the creation date .... (2 Replies)
Discussion started by: Board27
2 Replies

4. Shell Programming and Scripting

Looping over output of 'ls'

Hi, I have some output from 'ls' command and I want to loop over the output in a bash script. What would be a good way to go about it? For example, if the output of the ls command gives me 'prefix1 prefix2 prefix3', how can I set a loop that will iterate over these? many thanks! (5 Replies)
Discussion started by: pc2001
5 Replies

5. Shell Programming and Scripting

Read each line and saving the line in separate files

Hi Experts, I am having a requirement like this; Input file EIM_ACCT.ifb|1001|1005 EIM_ADDR.ifb|1002|1004 EIM_ABD.ifb|1009|1007 I want to read each line of this file and pass each line,one at a time,as an argument to another script. eg; 1.read first line->store it to a file->call... (2 Replies)
Discussion started by: ashishpanchal85
2 Replies

6. Shell Programming and Scripting

Need some Help for file filteration and saving the output in other directory

Hi all........ Plss do help me.......in a big trouble... :wall::wall::wall: I have 3 directories named as :1. /home/shuchi/source 2./home/shuchi/destination 3./home/shuchi/filter now the problem is /home/shuchi/source has say 2 files with extension .txt as given below : A.txt msisdn ... (5 Replies)
Discussion started by: ektubbe
5 Replies

7. Shell Programming and Scripting

saving output from bash into a file

I am ssh to many servers to get some information... however sometimes the server is unreacheable and i am getting an error. I want to save that output to a file but I am not able to do so... I want to be able to save output of bash into a file.. so when I run this command on a script ssh... (5 Replies)
Discussion started by: eponcedeleonc
5 Replies

8. UNIX for Dummies Questions & Answers

Saving a temporary output within a script

Good morning everyone, i am looking to know how to save the output of a command and reuse it again within a script i already tired this one but it didn't work TEMPDIR=/dir1/dir2 My_command> $TEMPDIR/$TEMPFILE rm $TEMPDIR/$TEMPFILE* it keeps saying "cannot write to a... (15 Replies)
Discussion started by: Portabello
15 Replies

9. UNIX for Dummies Questions & Answers

saving command output to a variable

Hello, I have a shell script containing a command string in the following format: command1 | command2 | cut -c9-16 The output from this is a record number (using characters 9-16 of the original output string) e.g. ORD-1234 I wish to save this value to a variable for use in later commands... (4 Replies)
Discussion started by: philjo
4 Replies

10. Shell Programming and Scripting

Saving output from awk into a perl variable

How would I pass awk output to a perl variable? For example, I want to save the value in the 4th column into the variable called test. My best guess is something as follow, but I am sure this isn't correct. $test = system("awk '/NUMBER/{print \$4}' $_"); (8 Replies)
Discussion started by: userix
8 Replies
Login or Register to Ask a Question