Adding Multiple Lines to Multiple Files

Hello,

I have three lines I need to add to hundreds of files. The files are all in the same format and contain the same information. I want to add the same information to the files.

The new lines of information are similar. Here is an example of the three lines:

line1:
line2 = text1
line3 = text2

They all should be on line 34, 35 and 36. Line 2 and 3 are right justified by 3 spaces.

The files all start with the same name separated by a period followed by some random number.

name1.number1

If someone can help me create a script, I would be very much appreciative.

Thank you,

dayinthelife

you could put the lines in a file like 'mylittlelines' then for the directory where all these files are

for file in *
do
cat mylittlelines >> $file
done

or use find with something like
for file in find . -name <pattern>
do
cat mylittlelines >> $file
done

That worked great and such a simple script, if you know what you are doing.

Thanks again!

:slight_smile: