Writing a text to many files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Writing a text to many files
# 1  
Old 06-17-2009
Writing a text to many files

Is there a command in shell-script that I can use that copies a string or writes it to many files? Say I have files a, b and c and I want to copy or write the text "Hallo, I am a newbie!" to all these files? I know I can do echo "Hallo, I am a newbie!" > a but this only copies it to one file. How can I do it to copy to all without repeating this command again and again.

Thanks in advance.
# 2  
Old 06-17-2009
'man tee'
Code:
echo 'Hallo, I am a newbie!' | tee a b c > /dev/null

# 3  
Old 06-17-2009
Thanks!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Efficient Text File Writing

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Write a template main.c file via shell script to make it easier for yourself later. The issue here isn't writing... (2 Replies)
Discussion started by: george3isme
2 Replies

2. UNIX for Dummies Questions & Answers

Writing text to file

Hi, I know the code to write a piece of text to the end of a given text file is echo $text >> filename.txt I would like to know how to write a piece of text to a file using shell, but the file name isn't given. I want it to write to whatever text file is currently open. Not to all text files... (2 Replies)
Discussion started by: anirudh215
2 Replies

3. Shell Programming and Scripting

Problem writing to different files

Hello: I have the following code: ---------------------------------- open (OUTPUT_FILE, ">>/usr/users/rovolis/PREPAID/CC/TCG/PP.$cyear$cmonth$cday.txt")||die "$!"; 82 open (OUTPUT_FILE2, ">>/usr/users/rovolis/PREPAID/CC/TCG/PR.$cyear$cmonth$cday.txt")||die "$!"; 83 # ... (0 Replies)
Discussion started by: chriss_58
0 Replies

4. Shell Programming and Scripting

Need help in writing a script to create a new text file with specific data from existing two files

Hi, I have two text files. Need to create a third text file extracting specific data from first two existing files.. Text File 1: Format contains: SQL*Loader: Release 10.2.0.1.0 - Production on Wed Aug 4 21:06:34 2010 some text ............so on...and somwhere text like: Record 1:... (1 Reply)
Discussion started by: shashi143ibm
1 Replies

5. Programming

Writing files using O_DIRECT in C

I am trying to write .pgm images using the O_DIRECT flag in open(). I have a char* buffer which has the image data. I know that I have to align the buffers and have done that using posix_memalign() yet only a part of the image gets written. Has someone used O_DIRECT for writing files... (3 Replies)
Discussion started by: anchit87
3 Replies

6. Shell Programming and Scripting

Writing files without temporary files

Hey Guys, I was wondering if someone would give me a hand with an issue I'm having, let me explain the situation: I have a file that is constantly being written to and read from with updated lines: # cat activity.file activity1 activity2 activity3 activity4 activity5 This file... (2 Replies)
Discussion started by: bashshadow1979
2 Replies

7. Shell Programming and Scripting

writing data in a text file at particular line

I need to write value of variable $version at a particular line in a text file. Line number is determined by another variable &line......I don't know how to do it in shell script ... (2 Replies)
Discussion started by: punitpa
2 Replies

8. UNIX for Dummies Questions & Answers

Reading and Writing Files ?

Hello, Our group is just starting to get into UNIX here. We are former REXX users on a VM Mainframe. Can someone point me to the documentation to read a file and write a file in a Unix Shell Script or does this have to be done in another language? Thank you in advance... Dave (3 Replies)
Discussion started by: tracydp
3 Replies

9. UNIX for Dummies Questions & Answers

What files are writing to a directory

Is there a way to tell what files/scripts are writing/wrote to a given directory? (3 Replies)
Discussion started by: hattorihanzo
3 Replies

10. UNIX for Dummies Questions & Answers

Picking out text from one file and writing it to another.

Hello. I have one file that is a collection of discarded emails. Each email is it's own section with each section beginning with the same header (ie 'Another Email' ). I want to traverse through the file and every time I find the header ('Another Email') I then want to pick out the 'To:' line... (5 Replies)
Discussion started by: scottf33
5 Replies
Login or Register to Ask a Question