With a loop:
for file in message*
do
cp template.txt "$file"
done
質問
Let's say I have text file called template.txt. template.txt contains the text "hello world."
I also have 10 other files named, message1, message2, message3, ect.
How can I copy the contents of template_message into message1, message2, message3, ect?
So far I've tried:
cp --copy-contentes template.txt *
cp --copy-contentes template.txt | xargs ls
解決
With a loop:
for file in message*
do
cp template.txt "$file"
done
他のヒント
yet another way of doing this
ls message* | xargs -n1 cp template.txt
Use a for
loop and append the index to the end of your destination file.
for i in {1..10};
do
cp template.txt "message$i"
done