Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-12-2007, 07:47 AM   #1
LQ Newbie
Registered: Nov 2006
Distribution: Kubuntu
Posts: 25

Rep: Reputation: 15
save file from std input

How can I save all input from a pipe command to a text file.

For example:
# cat any.text | ????? > new.text
What command will substitute ????? so the output of "cat any.txt " could be saved to another file. It's not about simply redirecting the "cat" command to file (using >), but a command to process something from stdin to create a file containing all output process.

One solution I could imagine is using "grep . > new.text", but this command will cut the space between the output. Is there any other solution.

Last edited by khairilthegreat; 08-12-2007 at 08:18 AM.
Old 08-12-2007, 09:07 AM   #2
Registered: Jun 2006
Location: Mariposa
Distribution: Slackware 9.1
Posts: 938

Rep: Reputation: 30
If I understand your question correctly, then do this at the shell prompt:

man tee
and all will be revealed.
Old 08-13-2007, 01:10 AM   #3
LQ Newbie
Registered: Aug 2007
Posts: 21

Rep: Reputation: 15
hope this will help u ,

cat any.text | >&1 tee -a new.text
Old 08-13-2007, 03:04 AM   #4
LQ Newbie
Registered: Nov 2006
Distribution: Kubuntu
Posts: 25

Original Poster
Rep: Reputation: 15

Thank you all. tee is the command I looking for.


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 can read from file.txt C++ where can save this file(file.txt) to start reading sam_22 Programming 1 01-11-2007 06:11 PM
[Perl] - save input in .html file noir911 Programming 2 01-07-2007 03:36 PM
C program that takes input "FName|LName" and outputs to std out its_godzilla Programming 2 01-18-2005 11:26 PM
Not able to save file shadow11 Linux - Newbie 4 10-21-2004 09:15 PM
Mozilla 1.7 - No File Save / File Open dialogs on Slackware 10.0 jayseye Slackware 8 08-10-2004 06:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 AM.

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