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

RE: script needed



perl -pi.bak -e 's/badsite.html/newsite.html/g' *.html

man perl can give details, basically this will do a global substitution of
badsite.html to newsite.html and save th eold files with a .bak extension

charles
Every day should be a Perl day !

> -----Original Message-----
> From: James Ervin [mailto: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]