看板 Perl 關於我們 聯絡資訊
大家好... 最近在寫一個script, 因為太魯,想了三天還沒想出來, 我想要讀取下列的input file,然後輸出ouput file, 兩者差異只是在於B, C, D, A, E,變成有序的排列A, B, C, D, E 做法看起來很簡單,用regular expression將module nand2 ( B, C, D, A, E )取出, 並用sort將其變成module nand2 ( A, B, C, D, E ); 但在回貼成ouput file想不到方法! 不知道大家有沒有好的Idea可以提供參考呢 ? ------------------input file---------------- // Library // LAST TIME SAVED: // NETLIST TIME: module nand2 ( B, C, D, A, E ); endmodule --------------------------------------------- ------------------ouput file----------------- // Library // LAST TIME SAVED: // NETLIST TIME: module nand2 ( A, B, C, D, E ); endmodule --------------------------------------------- -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 111.83.229.190 ※ 文章網址: https://www.ptt.cc/bbs/Perl/M.1427958478.A.CD6.html ※ 編輯: pat12345 (218.161.55.188), 04/03/2015 01:55:47
RishYang: 直接重寫整個檔案比較快 04/03 18:55
AntaresStar: Tie::File 04/19 16:27