[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: script needed



Im writing this without testing it, so syntax may be off:

for file in *.html
do
	mv $file $file.tmp
	cat $file.tmp | sed -e "s/badsite.html/goodsite.html/" > $file
done

Obviously, back up everything and test it first  ;)

> -----Original Message-----
> From:	James Ervin [SMTP:james kites org]
> Sent:	Thursday, October 01, 1998 12:01 PM
> To:	redhat-list redhat com
> Subject:	script needed
> 
> I have a site that has asked me to change all instances of a particular
> link in all of their web pages.  
> 
> I can list all of the pages that need to be corrected with something like:
> 
> grep -l badsite.html *.html
> 
> this gives me a list of the files to edit.
> 
> Are there any awk or shell scripting folks out there that can finish this
> off with something that would work like this:
> 
> grep -l badsite.html *.html | awk /s/badesite\.html/goodsite\.html/
> 
> This may be way off base, but you should get the idea of what I am trying
> to do.
> 
> What I want to do is replace instances of badesite.html with the string
> goodsite.html in the list of files generated by grep -l badsite.html
> *.html.  
> 
> 
> 
> end
> 
> James Ervin
> City of Bedford Network Administration
> admin ci bedford va us
> (540)586-7156
> 
> 
> -- 
>   PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
> http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips
> /mailing-lists
>          To unsubscribe: mail redhat-list-request redhat com with 
>                        "unsubscribe" as the Subject.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]