Redirecting output to both console and to a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Redirecting output to both console and to a file
# 1  
Old 08-23-2010
Redirecting output to both console and to a file

Hi All,

Is there a way in Bash we can redirection some output to both console and the file at the same time.

~Parag
# 2  
Old 08-23-2010
This is exactly what "tee" utility does. Here is an example:
Code:
cat file1 | tee copy_of_file1

# 3  
Old 08-23-2010
Thnx it worked.
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. Homework & Coursework Questions

Help with redirecting output to an HTML file

1. The problem statement, all variables and given/known data: I'm having trouble redirecting the output of my sysinfo_page script into my sysinfo_page.html file. The task at hand is to be able to email both the html file and the script to myself. I'm assuming that the html should appear as a web... (8 Replies)
Discussion started by: braing
8 Replies

3. Linux

RHEL 6.3 - chage command not redirecting the output to console.

When i am issuing chage command, it reporting the output properly. But when i redirect the output, i am not getting the output in the mentioned path. chage -l root >> /tmp/chage.txt. I need to use this into the script to capture the data. I think its seems to be bug with RHEL 6.3. Same... (3 Replies)
Discussion started by: Srini.rk1983
3 Replies

4. Solaris

Redirecting console output to ILOM during installation

Hi, I need to install solaris remotely via the ILOM port on a x4170 box, and I have downloaded the Solaris 11 for x86 - text install image and burned it on a DVD. When I boot the box, it's showing the boot_archive loading percentage on the SP console, but when it's done and start the interactive... (0 Replies)
Discussion started by: u_paludan
0 Replies

5. Shell Programming and Scripting

Perl :How to print the o/p of a Perl script on console and redirecting same in log file @ same time.

How can i print the output of a perl script on a unix console and redirect the same in a log file under same directory simultaneously ? Like in Shell script, we use tee, is there anything in Perl or any other option ? (2 Replies)
Discussion started by: butterfly20
2 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 that was redirected to variable and console

Hi all, I would like to store the output of a command in a variable and output it to the console at the same time. This is working fine using the following construct var=`command | tee /dev/tty` I use this in some scripts to display the output of the command on the console and, at the same... (2 Replies)
Discussion started by: script_man
2 Replies

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

9. AIX

Redirecting Both to a file and std output

Hello Friends, Can some one help me how to redirect output of a file to both a file and std output? All the help would be greatly appreciated. Regards Sridhar (1 Reply)
Discussion started by: send2sridhar
1 Replies

10. Shell Programming and Scripting

Redirecting <talk> output to a file

Is it possible to run <talk> such that both sides of the conversation are written to the screen and also to a file? I use the utility to chat with collaborators and sometimes it would be nice to have a record of our conversation while we are problem solving. I am running OS X, so <talk>... (4 Replies)
Discussion started by: cej
4 Replies
Login or Register to Ask a Question