LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Regex Question

[ILUG] Regex Question

Niall O Broin niall at linux.ie
Mon Sep 27 16:56:08 IST 2004


On 27 Sep 2004, at 16:47, John Allen wrote:

> # perl -pi -e 's|<div class="foo"></div>|<div 
> class="foo">TEST</div>|g' foobar.html

Ah John - would you ever read the man's original question? I reproduce 
the bit that makes this more than a completely trivial regex below.

>>>
>>> What I would like to be able to do is replace every n'th element with
>>> something else. So if n = 3, then the result is:
>>>
>>> <div class="foo"></div>
>>> <div class="foo"></div>
>>> <div class="foo">TEST</div>
>>> <div class="foo"></div>
>>> <div class="foo"></div>
>>> <div class="foo">TEST</div>

I also presume that his real source file is a little more complicated 
than the above but ICBW.




Niall




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell