By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,664 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,664 IT Pros & Developers. It's quick & easy.

find and replace in every file under a root folder

P: n/a
Hi all,

Suppose I want to add 1 single line:

<script src = "/sample.js" type="text/javascript"></script>

to every single webpage ( preferrably right after the tag <head>) under the
root folder called public_html in my server, i.e including all the webpages
in the subfolders as well. Suppose I have sample.js in public_html as well.

Can someone please spend some of your precious time to help me out with this
script.??

Thanks very much in advance
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cortes wrote:
Hi all,

Suppose I want to add 1 single line:

<script src = "/sample.js" type="text/javascript"></script>

to every single webpage ( preferrably right after the tag <head>) under the
root folder called public_html in my server, i.e including all the webpages
in the subfolders as well. Suppose I have sample.js in public_html as well.

Can someone please spend some of your precious time to help me out with this
script.??


The way I'd do it is to use UltraEdit's "Replace In Files" dialog.

Search for:

<head>^p

and replace with:

<head>^p<script src = "/sample.js" type="text/javascript"></script>^p

Select the directory, make sure sub direcories option is checked, and
hit replace.

http://www.ultraedit.com/downloads/index.html

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.
Jul 17 '05 #2

P: n/a
Thanks Justin,
That will work for files in my local machine.

But I want to make it in a script so that I can execute the script on the
server-side where my files are. Basically I don't want to download all the
files, replace, and then upload the updated files again.

Any ideas pls tell me.
Thanks alot
The way I'd do it is to use UltraEdit's "Replace In Files" dialog.

Search for:

<head>^p

and replace with:

<head>^p<script src = "/sample.js" type="text/javascript"></script>^p

Select the directory, make sure sub direcories option is checked, and
hit replace.

http://www.ultraedit.com/downloads/index.html


Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.