![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| retrieved multiple lines on multiple places in a file | dala | Shell Programming and Scripting | 8 | 03-14-2008 03:28 PM |
| Multiple file handling | rochitsharma | UNIX for Advanced & Expert Users | 8 | 04-30-2007 11:21 AM |
| Scp without writting | new2ss | Shell Programming and Scripting | 7 | 07-18-2006 06:59 AM |
| Help with multiple file rename - change case of part of file name | steve7 | UNIX for Dummies Questions & Answers | 7 | 06-30-2005 02:41 PM |
| Multiple file instances | gozer13 | UNIX for Dummies Questions & Answers | 1 | 12-29-2004 07:08 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Writting to multiple file
Hi!,
My script generates a lot of files while running.. The same output at any point may be diercted to some of them.. if I have 4 files file1 file2 file3 file4, echo "output" to file1 file2 file3 file4 Any ideas on how to do it?? |
|
||||
|
Look into the 'tee' command. You can use it to duplicate output between both standard output and a file. The -a option opens the file for appending, which is what I think you want. For example:
echo "some text" | tee -a file1 file2 file3 There's probably some trick you can also do with shell file descriptors, but I'm not familiar enough with those techniques. (Jinx! No backs! You owe me a Coke!) |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|