2008-09-03から1日間の記事一覧

Perlワンライナーで正規表現の文字列抽出

.cppファイルを探して行数でソート。 Perlのワンライナーで行数を抜き出す。 find . -name "*\.cpp" -exec wc -l {} \; | perl -ne 's/ .*//; print' | sort -gr cutコマンドでもいける find . -name "*\.cpp" -exec wc -l {} \; | cut -d " " -f 1 | sort -…

findコマンドの便利な使い方

-maxdepth: サブディレクトリーを無視した検索 find . -maxdepth 1 -exec 結果を他のコマンドに渡す "-type d"オプションでフォルダーのみをfind "du -s"で合計サイズのみを表示 {}に結果が入る \;は-execオプション終了の印 find . -type d -name sodomojo …