[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Edlug Archive Mar 2004 ]

Re: [edlug] Global Search and Replace

Peter George wrote:

Hello, one of my awful grep/fiind/regexp/vim type questions again I'm afraid.

I want to search every .html file in a series of nested directories, for '</body>' and replace it with the following code snippet saving all files automagically.

Is there an easy way to do this with a shell, or should I stick to EditPad or BBEdit?

I had to do something like this earlier today. If I remember right, I did something like:
find . -name '*.html' | xargs sed 's/<\/body>/<script>'

I've not bothered to put that script in the regex above, you might need to put it on one long line with escapes and \n for returns, unless someone else knows better...


You can find the EdLUG mailing list FAQ list at:

This archive is kept by wibble@morpheux.org.DONTSPAMME