Try a one-liner.
perl -pni.bak -e "s/1 (\w{1,2}v\w{1,2})/2 $1/" filename
and call that for every file.
Under windows you can say:
c:\> for %f in (*.html) do perl -pni.bak -e "s/1 (\w{1,2}v\w{1,2})/2 $ +1/" %f
I am not sure how to achieve the same under linux.
Note the %f is a shell-wildcard, not a perl hash.


holli, /regexed monk/


Update:
Silly me. I had in mind -p just prints $_ but it assumes loop like -n but print line also, like sed.
Thanks for clarifiying Animator.

Update:
Animator got me to read you're question more carefully. I think your more after something like this:
perl -pi.bak -e 's/\b(\w{1,2}v\w{1,2})\b/g<a href="$1.html">$1<\/a>/" +filename
Added a /g modifier just in case there can be more occurances in one line.

In reply to Re: A text replacement question by holli
in thread A text replacement question by steamerboy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.