Rename file-01.txt so it won't get matched by the "for" loop:
For every file whose name match the shell pattern "file-??.txt" ("file-", 2 characters, ".txt"), do whatever is written until "done", with the file name being stored in the variable "target".
Code:
for target in file-??.txt; do
rename the file so we won't mess with the next step:
concatenate the content of "foo" (was "file-01.txt") and the file we just renamed into a file with that name:
Code:
cat foo bar >$target
end of the "for" loop:
remove the last renamed file:
and you can rename back "file-01.txt"
"foo" and "bar" are just two names for temporary files: I wrote this code thinking that you'd type it directly in the shell, so you can check they won't accidentally overwrite existing files and change them if necessary, but if this is going into a script, you'll need some extra code to make the script check that.
Also, this code works only with the given set of filenames, if you need to "paste this into several files" you'll probably need a bit of reworking to make it more generic.