我正在使用 Perl 来实现这一点
while(<INFILE>){
chomp;
if(/\<td/){
system("perl -i -e 's/<td/<td bgcolor="blue"/g' $_");
}
}
当我运行命令时,我得到
./HtmlTest.pl file.html
Bareword found where operator expected at ./HtmlTest.pl line 13, near ""perl -i -e 's/<td/<td bgcolor="grey"
(Missing operator before grey?)
String found where operator expected at ./HtmlTest.pl line 13, near "grey"/g' $_""
syntax error at ./HtmlTest.pl line 13, near ""perl -i -e 's/<td/<td bgcolor="grey"
Execution of ./HtmlTest.pl aborted due to compilation errors.
我不知道为什么
即使我运行为
perl HtmlTest.pl file.html
我得到同样的错误。
示例 html 表
<td>ABC</td>
<td>DEF</td>
<td>20:00:00</td>
任何建议表示赞赏