On Monday 27 September 2004 16:56, Niall O Broin wrote:
> 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.
>
No wonder I had so little trouble failing those exams.
> >>> 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
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!