看板 Perl 關於我們 聯絡資訊
*********************************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 直接去執行他 請問要怎樣才能做這件事 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.202.87.29
mmonkeyboyy:就兩個while啊~:) 04/11 23:32
mmonkeyboyy:一個讀list一個做取代 搞定 04/11 23:34
mmonkeyboyy:最後再用system ''自動執行 04/11 23:35
dola2007:感恩 04/15 10:59