TOP ▲ itcore TOPTIPScgi_find.php  タグ:find php cgi 全角文字

findコマンド各種 | itcore 2017年

HPにCGIやPHPプログラムがあるかfindコマンドで探す。

cd <webroot>
find . -name "*.php" -o -name "*.cgi" -o -name "*.pl"

全角文字が含まれているプログラムファイルを探す。

find . -name '*.php' -print | xargs grep -n '' | perl -nle 'print "$_" unless /^\p{InBasicLatin}*$/' | sed -e 's/\/\*.*\*\///g' | sed -e 's/\/\/.*$//g' | perl -nle 'print "$_" unless /^\p{InBasicLatin}*$/'

・ファイル名と行番号を表示
・1行コメントを削除 /* xxx */ // xxx