[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Sheflug] replacing strings in multiple files.
* Richard Lowe (richlowe [at] btinternet.com) wrote:
> * Barrie Bremner (baz [at] barriebremner.com) wrote:
> >
> > Hi all.
> >
> > My scripting is a bit shakey, so I wonder if someone else can fix my
> > problems again :-)
> >
> > I've got a load of HTML files that have my email address in a mailto:
> > link in the footer.
> >
> > Is there an easy way (script preferably) that can grep out my old
> > address string and replace it with the new one?
> >
> > The closest thing I can think of is a combination of less | grep | sed
> > | echo but I'm clueless when it comes to putting it together -
> > especially at this time of night.
> >
> > Help? :-)
> >
>
> very very slightly tested (-i will make backups, but i suggest you so it
> anway).
>
> for i in *.html; do perl -wpi.bak -e 's/old email/new email/g' $i; done
>
>
I dont know how that loop crept in there, I blame the fact its late.
perl -wpi.bak -e 's/old email/new email/g' *
--
|*-------------------=[ Richard Lowe ]=------------------*|
| richlowe [at] btinternet.com UIN: 74724348 |
|*-------------------------------------------------------*|
| Europe has the Kilogram and the Meter. |
| America has the Pound and the Inch. |
| Childrens TV has the Elephant and the Double Decker Bus |
|*-------------------------------------------------------*|
---------------------------------------------------------------------
Sheffield Linux User's Group - http://www.sheflug.co.uk
To unsubscribe from this list send mail to
- <sheflug-request [at] vuw.ac.nz> - with the word
"unsubscribe" in the body of the message.
GNU the choice of a complete generation.