Weird....
Quote:
However no changes inside any of the HTML files - Got a .bak file for every file. Maybe because the script copies the HTML files and doesn't perform the change in every html file ? |
Quote:
Quote:
|
Working!!!
Changed the substring I wanted to replace - so the script now looks like this:
#! /bin/bash substring='<a HREF="index.html" TARGET="_top">Home</a> ' replacement='<script type="text/javascript"><!-- google_ad_client = "pub-5045815486985038"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; //2007-08-14: globabilityaug2007setup google_ad_channel = "5631073777"; google_color_border = "000000"; google_color_bg = "FFFFFF"; google_color_link = "0000FF"; google_color_text = "000000"; google_color_url = "008000"; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script><br><br> <a HREF="index.html" TARGET="_top">Home</a>' for file in *.html; do cp $file $file.bak # alternatively use 'mv' file_contents="$(<$file.bak)" echo "${file_contents//$substring/$replacement}" >$file done The above was saved into a text file called winner.sh and I have set the perms as you explained earlier in the thread so the script is executable by calling ./winner.sh HOURS UPON HOURS OF DREARY SYNTAX REPLACEMENT HAVE NOW BEEN SHAVED AWAY FROM MY TIME SPENT MAKING THESE CHANGES - AS WELL AS FUTURE ONES! THANKS A MILLION!!!!!!!!!!!!! |
All times are GMT -5. The time now is 10:26 PM. |