I
I
Igor Potapov2020-10-22 03:45:19
Data synchronization
Igor Potapov, 2020-10-22 03:45:19

How to add the same content to multiple files?

How can you quickly perform this action: you need to duplicate 100 lines with words (they are in one txt file) into other empty txt files with different names, so that, as a result, all files have the same content?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
ge, 2020-10-22
@gedev

If you are using Linux, then in bash this is done in one line:

$ touch {test1,test2,test3}.txt && cat test.txt | tee test1.txt test2.txt test3.txt

test.txt is the source file, the rest understood.
Here, files are first created with the touch command , then cat prints the contents of test.txt , and at the same time cat 's output is redirected to files via tee .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question