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

Re: script needed



James Ervin wrote:

> 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
>

try something like:

grep -l badsite.html *.html | sed 's/badsite.html/goodsite.html/' > foo.html

sed is your friend (-:

    -paul



>
> --
>   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.

--
"There is magic in the web" - Shakespeare (Othello, Act 3, Scene 4)





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