[[SLWRMemo]]

-Null Filter

 perl -wnl -e 'pring;' file file2
 perl -wnl -e 'print;' file file2

-SED-like replace function:

--"-n" --> feed each line into $_

 perl -wnl -e 's/^/    /g; print;' file

--"-p" --> feed & print each line  #beautifully simple!

 perl -wpl -e 's/^/    /g;' file

--モジュールのロード:-M オプション

 perl -00 -wnl -e 'print "$.:$_";' file | fmt -60

 perl -M'Text::Autoformat' -00 -wn -e 'print autoformat "$.: $_", {right => 60};' file


--スクリプトで実行

 perl -wnl -e 'print;' file

-これと同じものを vi で作って chmod で実行権限を与える

 vi perl_cat
 chmod +x perl_cat 
 ls -l perl_cat 
 -rwxr-xr-x  1 tono  tono  30  5  6 19:48 perl_cat 

 ./perl_cat file


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS