I have one statement needed to be substituted. The original format is like:
f.STRING.focus();
Where the STRING is the combination of [:alpha:] and [:digit:] (regular expression).
My purpose is to change it to
highlight("STRING");
For instance:
f.abCDef12345.focus() ---> highlight("abCDef12345");
f.ip2.focus() ---> highlight("ip2");
I can easily use sed to replace the statement for hundreds of html files. However, I don't know how to get the STRING in shell script.
Procedures can be described as follow:
For each html:
For the STRING which matches the pattern:
1. Assign it to a parameter.
2. Insert that STRING to highlight("STRING");
3. Replace the old one "f.STRING.focus();" to "highlight("STRING");"
But I don't know how to write them in shell script... Any hint is appreciated.
Updated:
- Please describe your script clearly. Thank you too much!
- SORRY FOR THE MISTAKE!
STRINGIS THE COMBINATION OF and[:alpha:]and[:digit:]. So the example mentioned heref.ip2.focus()can make sense.