[問題] 重複replace的問題

作者: dola2007 (....)   2013-04-11 18:33:43
*********************************code
$file = $ARGV[0];
$replace = $ARGV[1];
open(FILE,"<$file") or die "$file not found!!";
while( $line = <FILE> )
{
chomp($line);
$line =~ s/stand\.tmp/$replace\.tmp/;
$line =~ s/stand\.tmp2/$replace\.head/;
$line =~ s/stand /$replace /;
print "$line\n";
}
close(FILE);
**************************************************************
原稿
perl subckt1.pl LVDSTX_frame.cir stand > stand.tmp
perl subckt2.pl stand.tmp stand > stand.tmp2
希望得到
perl subckt1.pl LVDSTX_frame.cir Sedes > Sedes.tmp
perl subckt2.pl Sedes.tmp Sedes > Sedes.head
小弟是新手 目前的code 可以得到我要的結果
但是我想要取代的 replace name 一共有1000多筆
我希望能用一個list table 直接去執行他
請問要怎樣才能做這件事 謝謝
作者: mmonkeyboyy (great)   2013-04-11 23:32:00
就兩個while啊~:)一個讀list一個做取代 搞定最後再用system ''自動執行
作者: dola2007 (....)   2013-04-15 10:59:00
感恩

Links booklink

Contact Us: admin [ a t ] ucptt.com