echo "ABC" > file1.txt file2.txt file3.txt


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers echo "ABC" > file1.txt file2.txt file3.txt
# 1  
Old 01-28-2008
Error echo "ABC" > file1.txt file2.txt file3.txt

Hi Guru's,

I need to create 3 files with the contents "ABC" using single command.
Iam using:
echo "ABC" > file1.txt file2.txt file3.txt
the above command is not working. pls help me...

With Regards / Ganapati
# 2  
Old 01-28-2008
Try this link below....it uses Unix command called "tee"

https://www.unix.com/unix-dummies-que...ple-files.html
# 3  
Old 01-28-2008
Tools

Code:
echo "ABC" | tee a | tee b > c

# 4  
Old 01-30-2008
Power

Thanks for your answers to all,

But "tee" will leave the output on the terminal, which is not recommended by the requested standard.Smilie

Are there any other ways to create these files in a single step, without using 'tee'?

Only thing is to create three or more files with the contents "ABC" using a single command.Smilie

Thanks / Ganapati...
# 5  
Old 01-30-2008
The answer provided by Tytalus fits your needs.

Quote:
echo "ABC" | tee a | tee b > c
The STDOUT is piped, and then in the last command it is redirected. There is no step in this command string that will print to the screen.

Please test solutions before dismissing them Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

[Python] replicating "sha256 -C checksum_file.txt file.txt"

Hello everyone, Since my python knowledge is limimted, I've challenged myself to learn as much as possible to help me with my carrere. I'm currently trying to convert a shell script to python, just to give myself a task. There is one section of the script that I'm having issues converting and... (2 Replies)
Discussion started by: da1
2 Replies

2. Shell Programming and Scripting

Delete file2.txt from file1.txt using scripting

Hi, I`m a total newbie, well my requirement is that i have 2 files I want to identify which countries i do not currently have in db.. how can i use the grep or another command to find this file .. i want to match all-countries.txt with countries-in-db.txt so the output is equal to... (11 Replies)
Discussion started by: beanbaby
11 Replies

3. Shell Programming and Scripting

finding the strings beween 2 characters "/" & "/" in .txt file

Hi all. I have a .txt file that I need to sort it My file is like: 1- 88 chain0 MASTER (FF-TE) FFFF 1962510 /TCK T FD2TQHVTT1 /jtagc/jtag_instreg/updateinstr_reg_1 dff1 (TI,SO) 2- ... (10 Replies)
Discussion started by: Behrouzx77
10 Replies

4. UNIX for Dummies Questions & Answers

find lines in file1.txt not found in file2.txt memory problem

I have a diff command that does what I want but when comparing large text/log files, it uses up all the memory I have (sometimes over 8gig of memory) diff file1.txt file2.txt | grep '^<'| awk '{$1="";print $0}' | sed 's/^ *//' Is there a better more efficient way to find the lines in one file... (5 Replies)
Discussion started by: raptor25
5 Replies

5. Homework & Coursework Questions

how to change this looking for mimetype "text/plain" instead of extension *.txt?

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: Create a Shell script that looks for all text files in your home directory (including subdirectories). List... (3 Replies)
Discussion started by: rollinator
3 Replies

6. Shell Programming and Scripting

"Time" command and save result in a file.txt

Hi, I'am using "time" to check execution time of some script. Is there any possibility to save time command result into a file ? (2 Replies)
Discussion started by: Physix
2 Replies

7. Shell Programming and Scripting

How to get the output from [ -s "abc.txt" ]

Hi, I am trying to check the file not empty, if its not empty then i try to send other system by ftp, the following codes doesnt work if ] then echo "File ${OUTBOUNDFILE} have data" ftp -i -n -v 204.104.22.33 >> ${FTP_LOGFILE} << EOF user abc def ascii put ${OUTBOUNDFILE} quit EOF... (1 Reply)
Discussion started by: Imran_Chennai
1 Replies

8. UNIX for Dummies Questions & Answers

grep/cat/more -- search in a txt file and display content from a specific "keyword"

Hi, I have a .txt file Sample: ===================== NEXT HOST ===================== AEADBAS001 ip access-list extended BLA_Incoming_Filter ip access-list extended BLA_Outgoing_Filter access-list 1 permit xxxxxxxxxxxxxx access-list 2 permit xxxxxxxxxxxxxx =====================... (4 Replies)
Discussion started by: I-1
4 Replies

9. Shell Programming and Scripting

Sorting problem "sort -k 16,29 sample.txt > output.txt"

Hi all, Iam trying to sort the contents of the file based on the position of the file. Example: $cat sample.txt 0101020060731 ## Header record 1c1 Berger Awc ANP20070201301 4000.50 1c2 Bose W G ANP20070201609 6000.70 1c2 Andy CK ANP20070201230 28000.00... (3 Replies)
Discussion started by: ganapati
3 Replies

10. Shell Programming and Scripting

Find -name "*.txt" in Korn Shell Script

The following find command works on the Korn Shell command line: find . \( ! -name . -prune \) -type f -name "*.txt" -mtime +100 In the particular directory I'm in, the above find will list correctly the three text files that exist that haven't been modified in over 100 days: ... (3 Replies)
Discussion started by: jwperry
3 Replies
Login or Register to Ask a Question