SLWRMemo

  • Null Filter
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
Last-modified: 2012-05-06 (日) 19:57:16 (4371d)