Redirecting the results to different output files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Redirecting the results to different output files
# 22  
Old 05-18-2016
I repeat myself: Where does
Code:
       for (i=2; i<=CNF+2; i++){printf "%7s", T[i] > ofn} if(i==18) {printf[/COLOR] "%7.3f",T[i]=TMP> ofn}
                                                        ^--- this   ^---  and this

come from, when the working solution had
Code:
for  (i=2; i<=CNF+2; i++){printf "%7s", T[i]; if(i==18) {printf  "%7.3f",T[i]=TMP}}

Why and when did you introduce those?
# 23  
Old 05-18-2016
Hi Rudi,

I have changed the code because you have suggested me as below:

Redirect EVERY SINGLE print/printf to ofn.

Then after changing the code like this,

Code:
for (i=2; i<=CNF+2; i++){printf "%7s", T[i] > ofn} if(i==18) {printf[/COLOR] "%7.3f",T[i]=TMP> ofn

}

outputs are resulting to output1 and output2 without displaying output to the screen.

Regards,
am24

---------- Post updated at 07:40 AM ---------- Previous update was at 07:33 AM ----------

if i use the code:
Code:
for  (i=2; i<=CNF+2; i++){printf "%7s", T[i]; if(i==18) {printf  "%7.3f",T[i]=TMP}}

and printf Rs > ofn or print "" > ofn, outputs are displaying to the screen and also wrong output1 output2 are generated.

Regards,
am24
# 24  
Old 05-18-2016
Please try
Code:
for  (i=2; i<=CNF+2; i++){printf "%7s", T[i] > ofn; if(i==18) printf  "%7.3f",T[i]=TMP > ofn}

This User Gave Thanks to RudiC For This Post:
# 25  
Old 05-19-2016
Hi Rudi,

Now i ma able to get the outputs properly with the code:

Code:
for  (i=2; i<=CNF+2; i++){printf "%7s", T[i] > ofn; if(i==18) printf  "%7.3f",T[i]=TMP > ofn}
{ printf RS > ofn}

Thanks a lot for your time and suggestions on this.

Regards,
am24
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk: Print Error While Redirecting output in multiple Files

Hi, I have a following code in which I am unable to redirect to multiple files. Can anybody please help with some corrections awk -F, '{ if ( substr($1,26,2)=="02" && substr($1,184,14)=="MTSCC_VALFIRST") { array1++ array2++ array3++ } else if (substr($1,26,2)=="03" &&... (4 Replies)
Discussion started by: siramitsharma
4 Replies

2. Post Here to Contact Site Administrators and Moderators

Redirecting grep output to multiple files

Hi All, I am trying to redirect the grep output to multiple files, can you please help with that. Below is the command im using to match my pattern grep \<proxyType\>$PxyType $DIR/EndureFiles.json > File_Name*.json Note : $DIR and $PxyType is already defined in my script Im able... (0 Replies)
Discussion started by: Deena1984
0 Replies

3. Shell Programming and Scripting

Redirecting the output

For example, if we run the below command, symcfg list -thin -pool , results in an output most of the times and if the out is generated i'm able to redirect the output to a file. but sometimes it doesnt result any output and even though the output is being redirected, i can see "No Thin Pools "... (2 Replies)
Discussion started by: web2moha
2 Replies

4. Shell Programming and Scripting

awk help: Match data fields from 2 files & output results from both into 1 file

I need to take 2 input files and create 1 output based on matches from each file. I am looking to match field #1 in both files (Userid) and create an output file that will be a combination of fields from both file1 and file2 if there are any differences in the fields 2,3,4,5,or 6. Below is an... (5 Replies)
Discussion started by: ambroze
5 Replies

5. Shell Programming and Scripting

Redirecting output to file

Hi, Below is the whole string which is to be redirected to the new file. su - oracle -c "exp $user/$pass file=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.dmp log=/oracle/oradata/backup/exp_trn_tables_`date +%d_%b_20%y_%H_%M_%S`.log tables=table1,table2 statistics=none" ... (3 Replies)
Discussion started by: milink
3 Replies

6. Shell Programming and Scripting

Redirecting to different output files with awk.

Well, it didn't take me long to get stumped again. I assure you that I'm not mentally deficient, just new to scripting. So, here's the gist. I want to redirect output from awk based off of which branch of an if-else statement under which it falls. #!/bin/bash #some variables... (2 Replies)
Discussion started by: mikesimone
2 Replies

7. Shell Programming and Scripting

Redirecting echo output to 2 flat files

Hello all, I have the following 2 questions.. 1) I would like to capture the output of an echo command to 2 different files at the same time. This does not seem to work. Any ideas? echo ==== started on `date` ==== >> res1.log res2.log 2) Would it be possible to just get the 5th... (2 Replies)
Discussion started by: luft
2 Replies

8. Programming

execl() + redirecting output to text files

Im currently using execl() to run the ls command and redirect the output to a text file. Unfortunately, when I check the text file, no information has been written to it. I am calling execl() with the ls command like this execl( "/bin/ls" , "-al" , '>' , "dirlist.txt" ,(char *) 0 ); ... (5 Replies)
Discussion started by: JamesGoh
5 Replies

9. Shell Programming and Scripting

Redirecting OUTPUT

Hi, I want to move the output of a command/script to a file as well as to to be displayed on stdout. Can anybody help me in this. Thanks in advace .. -Chanakya M (1 Reply)
Discussion started by: Chanakya.m
1 Replies

10. UNIX for Dummies Questions & Answers

Redirecting output to multiple log files?

If I wanted to redirect output to multiple log files, what would be the best way to do that? echo "Unix is awesome" >>unixgod.log >>unixgod.log (3 Replies)
Discussion started by: darthur
3 Replies
Login or Register to Ask a Question