LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-24-2005, 01:50 AM   #1
Akhran
Member
 
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
Possible to pipe output and error to a file while displaying them on monitor?


Would it be possible to display the results of 'cat testfile' on the monitor while piping the standard output and error to a file? I tried 'cat testfile &> capturedfile', but the content of 'testfile' is not displayed on the monitor (the content is however piped successfully into the capturedfile).

Also, does the tee command capture error output in the file (capturedfile) too? Eg.

'cat testfile |tee capturedfile'

Thanks !
 
Old 11-24-2005, 02:01 AM   #2
rtg
Member
 
Registered: Aug 2005
Location: Ukraine
Distribution: Ubuntu 9.04
Posts: 99
Blog Entries: 3

Rep: Reputation: 19
To capture the stderr, you need to use the second descriptor (first iss the stdout), like
Code:
cat myfile.txt 2>&1 | tee myfile
which makes the stderr go to stdout and then through the pipe to 'tee', which will log it and print.
 
Old 03-29-2006, 05:04 AM   #3
Ander
Member
 
Registered: Apr 2003
Location: Vancouver
Distribution: Debian
Posts: 37

Rep: Reputation: 15
Cool! I was going to post a message about that, but you'd answered it. Thanks.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pipe output from make BBB Programming 2 05-20-2005 06:14 AM
pipe xine output to file sohmc Linux - Software 0 01-01-2005 10:03 PM
Pipe telnet session output to text file joshlamerritt Linux - Software 3 02-10-2004 08:42 PM
Output truncated when using pipe tells Linux - General 1 12-16-2003 08:06 PM
pipe output to append to a text file davee Linux - Newbie 3 08-27-2003 05:03 AM


All times are GMT -5. The time now is 12:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration