What I would like to do is take a directory and replace every single occurance of a string in a file as well as in file names. So for example inside the file if I have the string "specialstring" then it will replace all of those occurances changing them to "newstring" but also if a file is called "coolfilespecialstring.php" it will change it to coolfilenewstring.php. Also keep capital letters capital letters etc. Oh here is a really good challenge! Perhaps someone knows of some criteria to distinguish between file calls and text. What I actually want to do is change all text say the "specialstring" in the text of files to the "newstring" but leave the file names alone. But the catch is finding some kind of criteria that will only change something that is a text string such as <h1>specialstring</h1> and not a file call in a program such as specialstring.php. That is actually what I would like to do but I don't know what methods would do that.
On top of that I would like to write a perlscript function to do a grep on a specific directory, hopefully to return if and where a searchstring is embedded into html tags say <h1> and </h1>. I however can not get the script to work, there are always errors no matter what I do. Here is an example:
#!/usr/bin/perl
grep -Hrn Searchstring ./Searchfolder
I can get other scripts to work, just not this one and I don't know why. Any ideas? Hows about adding the regex? My biggest concern however is getting the grep shell script to work.
Any ideas?
Thanks,
Brian
On top of that I would like to write a perlscript function to do a grep on a specific directory, hopefully to return if and where a searchstring is embedded into html tags say <h1> and </h1>. I however can not get the script to work, there are always errors no matter what I do. Here is an example:
#!/usr/bin/perl
grep -Hrn Searchstring ./Searchfolder
I can get other scripts to work, just not this one and I don't know why. Any ideas? Hows about adding the regex? My biggest concern however is getting the grep shell script to work.
Any ideas?
Thanks,
Brian