カレント直下のサブディレクトリ内で同一コマンドを実行
各サブディレクトリでpwdコマンドを実行する例
$ find "$PWD" -mindepth 1 -maxdepth 1 -type d | while read -r line; do cd "$line" && pwd; done;
全サブディレクトリに再帰的にコマンドを実行したい場合は、maxdepthの指定を外せばOK。
Read more about カレント直下のサブディレクトリ内で同一コマンドを実行
各サブディレクトリでpwdコマンドを実行する例
$ find "$PWD" -mindepth 1 -maxdepth 1 -type d | while read -r line; do cd "$line" && pwd; done;
全サブディレクトリに再帰的にコマンドを実行したい場合は、maxdepthの指定を外せばOK。
Read more about カレント直下のサブディレクトリ内で同一コマンドを実行
実行可能なPHPファイルを検索
$ find . -perm /u+x -type f -name "*.php"
カレント直下のサブディレクトリ内で同一コマンドを実行
$ find "$PWD" -mindepth 1 -maxdepth 1 -type d | while read -r line; do cd "$line" && pwd; done;
*.mp3ファイルを999個探して、mpg123でランダム再生 Read more about なんでもfindお役立ち実例集
テキストファイルを検索して、UTF-8へ文字コード変換
$ find /tmp -type f | egrep '/.*\.(txt|text)$' | xargs -d '\n' nkf -w --overwrite
空行削除
$ grep . filename $ sed '/^$/d' ./sample.txt
改行削除、空白文字トリムして、テキストファイルの内容をwindowsクリップボードにコピー(cygwin用) Read more about 仕事をサボるためのテキストコマンド実例集