I know that
cat file1 >> file2
would append the contents of file1 at the end of file2. On the other hand, how can I append the contents of file1 at the beginning of file 2, and not at its end?
Actually, i have a single master file M, and several other files in a directory D. I want to append the contents of file M at the beginning of all the files in the directory D.
Just do:
cat file1 file2 > tmp && mv tmp file2
For each file you could do:
cat MASTER file >> file.tmp
And then move file.tmp over file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With