Quick! Edit!

Quick! This is a text editing challenge. I want to see how to do this with your tool/s of choice.

You have a HTML page that has a form with 32 form fields on it. Some of them are type=”text”, some of them are type=”file”.
On all the text fields, you need to copy the part after “myform_” from the name=”myform_foo” attribute to the value attribute, uppercase it, prepend it with $ and wrap it in { and }, so you go from:

<input name="myform_foo" type="text" value="">

to

<input name="myform_foo" type="text" value="{$FOO}">

on each instance of the text input field.
Assume the html is relatively nicely formatted.

How would you do this?