redirecting the script output to more than 1 file


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers redirecting the script output to more than 1 file
# 1  
Old 01-24-2011
redirecting the script output to more than 1 file

Hi,
I want to redirect my script output to more than one file without printing the result to the screen. How to do that?

ex:

Code:
echo "hi" >> a.txt b.txt
 
cat a.txt
hi b.txt

Smilie
# 2  
Old 01-24-2011
Code:
echo "hi" | tee -a a.txt >> b.txt

# 3  
Old 01-24-2011
Example for say three files:

Code:
echo "hello" 2>&1 | tee -a a.txt | tee -a b.txt >> c.txt

The "2>&1" just combines STDERR and STDOUT .
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Redirecting output to file

Hi, I have created script which redirect the output to file.I am able to get the output in file but not in the format. Output :Content of the log which have 10 -15 lines. Actal :Line1 ..Line 2Line3 Line4 Line 5 Expected:Line1 Line 2 Line3 Please... (7 Replies)
Discussion started by: karthik771
7 Replies

2. Shell Programming and Scripting

Redirecting command output to a file in a shell script

Hello All, I have some unique requirement. I have written a very lengthy script which calls number of resource script to execute a particular task. What I want is output of each command(called from main script and resource scripts) should go to a... (3 Replies)
Discussion started by: anand.shah
3 Replies

3. Shell Programming and Scripting

Redirecting output for the entire script

Hi All, I am trying to redirect output for every line in a korn shell script that is going to generate output and append it to a log file. I have been doing this after EACH and every line that is going to produce output: command 1 >> test.log command 2 >> test.log command 3 >>... (5 Replies)
Discussion started by: MIA651
5 Replies

4. Shell Programming and Scripting

Redirecting script output to terminal

When ever i started my terminal,Every time I have to change the directory like "cd user/documents/ravi/folder2/folder3" Without typing this entire command every time ,I placed "alias c='cd user/documents/ravi/folder2/folder3'" in .bash_profile file. so that i can able to execute command 'c'... (6 Replies)
Discussion started by: Raviteja saddal
6 Replies

5. UNIX for Dummies Questions & Answers

redirecting script output

Hello, I am interested in taking the output from a script i wrote and using it as input to a different script i wrote. So for example i want to take the output from program2 and use it as a parameter for program1. I didnt think i could use the >> symbols because i think that is just for .txt... (4 Replies)
Discussion started by: GmGeubt
4 Replies

6. 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

7. Shell Programming and Scripting

Redirecting output of a command to a file

Hi We are having a requirement where one shell script, say a.sh (which uses Java and connects to Oracle database using JDBC) keeps on running everytime. I created a wrapper (to check whether a.sh is running and if not then to start it) and scheduled it in the crontab. Now all the output from... (3 Replies)
Discussion started by: ankitgoel
3 Replies

8. Shell Programming and Scripting

redirecting SQL output from within a shell script

Hi all I would like to open a SQL session from within a shell script and then redirect the output of the SQL command to a file. e.g. #!/bin/bash sqlplus "/ as sysdba" <<EOF @$HOME/recovery_space.sql EOF I want to redirect the output of the SQL command to a temp file, because... (2 Replies)
Discussion started by: soliberus
2 Replies

9. Shell Programming and Scripting

Redirecting to standard output from within called script

Hi, How to achieve this? Let us assume the following: There are 2 scripts a.ksh and b.ksh $ cat a.ksh sh b.sh 2>&1 >> /work/log/a_log.txt $ cat b.sh echo "abcd" My requirement is, is there a way to display this abcd in standard output also alongside of writing into a_log.txt?... (8 Replies)
Discussion started by: vigneshra
8 Replies

10. UNIX for Advanced & Expert Users

redirecting output to file in network

Hi Experts, Is it possible to redirect the output of an unix command to file. when i "telnet" to a remote system and execute the redirection operation, such that the result should outputted to my system. $ telnet IPaddr2 username : zzzzz password : ******** IPaddr2>ls > file <- i... (1 Reply)
Discussion started by: anent
1 Replies
Login or Register to Ask a Question