Add Text to Beginning of 200 Files
I have 200 php files. I want to add 2 lines of text to the beginning of each one. (I plan to open source the app, so 2 lines about the GPL and what it all means.)
Is there anyway to do that? I looked at cat, but it can append or overwrite. I want to run a little script that will add the same 2 lines I specify to all 200 *.php files. Thanks. |
there are a million ways to do this, off hand i would say create a header file containing what you want, and then just cat that file and a php file and redirect it.
Code:
for file in original/*.php |
Sounds like the perfect job for sed. There are plenty of quickstart guides about the internet that will do a better job of explaining how to use it than I can in a post.
|
initially i was gonna suggest sed, but you're still really going to have two seperate files to join together somehow.
|
All times are GMT -5. The time now is 06:25 PM. |