What is the easiest way to do this using Perl, Python or a shell script?
I would use Perl, but that is because I know Perl much better than I know Python. Damn, maybe I'll do it in Python to find out a little better.
The easiest way is to use a language that you are familiar with and can work with. And that, too, is probably the best way.
If these are all Python scripts, I understand that you know Python or have access to a group of people who know Python. So you are probably doing a better project in Python.
However, this is also possible with shell scripts, and if you know what the best shell is, be my guest. Here's a little, completely untested shell script right from my head:
find . -type f -name "*.py" | while read file do sed 'i\ I want to insert this line ' $file > $file.temp mv $file.temp $file done
David W.
source share