How to output thre result to a text file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to output thre result to a text file?
# 1  
Old 11-26-2012
How to output thre result to a text file?

Dear All

I have a script file like the following:

Code:
 
.....
.....
Variable_1 = 888
Variable_2 = 999
.....
MyExternalProgram Myfile
.....

The line
Code:
MyExternalProgram Myfile

will generate some number, Say 777

Now I hope I can output the result of above codes to a text file, which would look like:

Code:
888 999 777

How could I do that?
# 2  
Old 11-26-2012
try:
Code:
Variable_1=888
Variable_2=999
 
Variable_3=$(MyExternalProgram Myfile)
 
echo $Variable_1 $Variable_2 $Variable_3> text_file

This User Gave Thanks to rdrtx1 For This Post:
# 3  
Old 11-26-2012
Thank you so much for helping me.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep output to file result not as expected

Hi Gurus, I run command grep ABC file1 > file2 against below file. I got all ABC_xxx in one line in file2. I expect to get multiple lines in file2. If I print result in screen, the result is expected. thanks in advance My os is SunOS 5.10 Generic_150400-64 sun4v sparc sun4v ABC_123 XXXXX... (2 Replies)
Discussion started by: green_k
2 Replies

2. Shell Programming and Scripting

Average result of text file

Hi all I have created a script to allow me to gain a number of file times and how long they take to execute. I have been asked to get the average time for the log. The log will update every 5 minutes and never be empty. 141 152 157 161 168 169 171 179 202 207 229 651 666 714... (3 Replies)
Discussion started by: simpsa27
3 Replies

3. Shell Programming and Scripting

Save result to a text file

Currently I have a perl code to combine two different files. #! /usr/bin/perl -w use strict; open FP1,"A.txt"; open FP2,"B.txt"; my ($l1,$l2); while(1) { $l1=<FP1>; chomp $l1; $l2=<FP2>; chomp $l2; last unless(defined $l1 or defined $l2); print "$l1 $l2\n"; } close FP2;... (4 Replies)
Discussion started by: Tzeronone
4 Replies

4. Shell Programming and Scripting

Write result to output file

Good morning everybody, Beeing an absolute newbie in shell scripting I would like to look for some help here. I would like to read an external text file and format the data and write it to an output file. What I was trying to do was to display the result (this worked). But now I... (1 Reply)
Discussion started by: bluejean1976
1 Replies

5. Shell Programming and Scripting

Append Text in Result File Name

Hi Below command is returning the list of files which having this string "MTL_SYSTEM_ITEMS". find . -name "*"|xargs grep -il MTL_SYSTEM_ITEMS Ex: Above command is returing 2 files (Out of 10 files 2 files having this string). ./file1.txt and ./file2.txt Here I want to append... (3 Replies)
Discussion started by: balajiora
3 Replies

6. UNIX for Advanced & Expert Users

Output the SQL Query result to a File

Hello Guys, This message is somewhat relates with last thread. But I need to re-write thing. I start over a little. I am stuck now and need your help. Here is my script- #! /bin/ksh export ORACLE_HOME=/opt/oracle/app/oracle/product/9.2 /opt/oracle/app/oracle/product/9.2/bin/sqlplus -s... (5 Replies)
Discussion started by: thepurple
5 Replies

7. Shell Programming and Scripting

Displaying Result to a Text File

Hi; I am scripting in Shell and i want to write output (on screen) to a text file? ... | tee gcsw/output.txt doesnot work? :(:( (6 Replies)
Discussion started by: gc_sw
6 Replies

8. Shell Programming and Scripting

Way to save output result of a program into another new file...

Does anybody know any alternative way to save output result of a program into another new file? I got try the command below: program_used input_file > new_output_file program_used input_file >> new_output_file Unfortunately, both the ">" and ">>" is not work at this case to save the output... (6 Replies)
Discussion started by: patrick87
6 Replies

9. Shell Programming and Scripting

Need to Output result to a non-delimitted file

Hello I need to run an sql script and then the output result to be in non-delimitted file What is the execution command to obtain this. For eg: the following outputs the result to a space delimitted file db2batch -d ${EC_DB2_DBNAME} -f ${TMP_SCRIPT_NAME} -a ${CURR_DB_ID}/${CURR_DB_PWD} -r... (1 Reply)
Discussion started by: cosec
1 Replies

10. Shell Programming and Scripting

any possible to run sql result and output to file

Hi, I search all post...and no soluation about..if i would like to run a sql statement and output the result to txt file. for example, i usually run "sql" to logon the database and run select statement. Then I need to copy the output into the result.txt. Can I run the script to do this... (7 Replies)
Discussion started by: happyv
7 Replies
Login or Register to Ask a Question