perl -pe 'if (/^foo(\\d+)=(.*\\n)/) {$r ||= $2; $_="foo4=$r" if 4==$1;}' testdata notice I am using ttffp tags
now I want to be sure I clearly understand what is going on. I throw my file at this string
perl -pPrint -eEdit single tick to resolve the following enclosed actions
if (what is the / before the first foo? ^foo followed by a decimal place holder and has a .* followed by a newline and the closing /?
$r is replace || (why the 2 pipes? $2 being the second field $_"foo4=$r(eplaced value) if 4 is exactly equal to $1 the first field. ending tick
corrections and information gladly accepted,
thanx,
bill