作者banco (Acoustic)
看板Perl
標題[討論] Perl的命令列用法
時間Mon Jan 5 22:44:03 2009
我的目錄下有幾千筆檔案要處理
因為要處理的 regular expression 很短
所以可以直接透過 >> perl -ne 'my_regexp' myfile 來處理
目前我的作法是把上面的指令夾在 shell script 裡
例如:
>> for myfile in my_dir; do perl -ne 'my_regexp' ${myfile}; done
請問有沒有比較快一點的方式來完成以上的動作
也就是不需要用到 shell script 所提供的 loop 功能
(雖然我知道多打for那些花不了太多時間,但想更懶一點....)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.27.154
1F:→ cibs:find | xargs 01/06 00:01
2F:→ banco:感激不盡,真有趣的用法 :) 01/06 00:15
3F:→ reizarc:使用 File::Find 01/06 00:30
4F:→ banco:樓上誤會我的意思了,程式要直接打在命令列裡,所以沒實體pl檔 01/07 12:51
5F:→ kornelius:還是可以阿 03/23 11:47
6F:→ kornelius:加上 -MFile::Find::Rule -e '{code}' 03/23 11:48