The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
redirect output to a file name csecnarf UNIX for Dummies Questions & Answers 7 06-16-2008 12:45 AM
redirect output to log file kalyanraj Shell Programming and Scripting 2 06-06-2007 09:40 PM
Redirect output to a file jimmyc UNIX for Dummies Questions & Answers 11 01-31-2007 08:34 AM
Redirect time output cbeech UNIX for Dummies Questions & Answers 2 03-24-2006 05:36 PM
redirect output to file? slackware Shell Programming and Scripting 1 09-11-2003 11:57 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-23-2008
Registered User
 

Join Date: Jul 2008
Posts: 4
Red face redirect to both file and std output at the same time

hello

can some one please help me to redirect the output of a command to both std output and a file. this is little urgent.

sridhar
Reply With Quote
Forum Sponsor
  #2  
Old 09-23-2008
Smiling Dragon's Avatar
Disorganised User
 
Join Date: Nov 2007
Location: New Zealand
Posts: 734
Use the 'tee' command:
Code:
/usr/bin/generate_stdout | tee -a /filename/to/append/sdtout/to.txt | ./my_command
Reply With Quote
  #3  
Old 09-23-2008
Registered User
 

Join Date: Sep 2008
Posts: 13
I'm not sure which unix you are using, but if you have the 'tee' command installed, you can use that.

Code:
# echo hello | tee outfile
hello
Code:
# cat outfile
hello
you can use the -a option to just append to the file

Code:
# echo world | tee -a outfile
and now you have

Code:
# cat outfile
hello
world
If you dont have tee, and cant install it, then you are probably looking at some crazy file descriptor re-assignment/redirection, of which i'm not entirely keen.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:04 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0