Mass add Clicky code into a bunch of HTML files

kyaizen

揸緊中指
May 26, 2007
606
1
0
Is there a script that does this?

I've got to add a short snippet of code (Clicky) into a bunch of HTML files and it's a pain in the arse to do manually.
 


Just figure out where you want it and do a Search/Replace.

example: if you want it just before the </head> tag

Search for </head>

replace with <Your Code Snippet Here></head>
 
Yes, but it's bloody painful to do for 982 pages
 
Either get free windows search and replace software to do it on your local mahcine (12 replace works great).

or use grep and do it on the server.
 
Notepad++ does this quite fine. It has a find and replace in files capability that you can utilize to update files with filters by file type and the ability to follow sub folders as well. Plus it's free.
 
Notepad++ works like a fucking charm. Thanks fellas
 
Sublime Text is more than capable of this kind of find and replace in unopened docs.

That being said, you should be using includes for your header and footer so that you only have to place this kind of code once on your site.
 
Be sure to backup the whole folder of HTML files before running the mass find and replace. There is no undo if you typo!