1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【コマンド】全角文字が含まれるファイルのリストを取得するコマンド

Posted at

あるフォルダの中のファイルで,全角文字が含まれるファイルのリストを取得したい場合に使えるコマンドです.

OSS公開時などにプロジェクトに日本語のコメントを英語化する必要がある場合などに使えます.

全角文字が含まれるファイルのリストを取得する

正規表現によってASCII以外の文字を検出することで実現できます.

find [検索対称フォルダのパス] -type f | LANG=C xargs grep -n -v '^[[:cntrl:][:print:]]*$' --binary-files=without-match

特定の拡張子のファイルのみ対象としたい場合は,以下のようなコマンドを叩きます.

find [検索対称フォルダのパス] -type f -name "*.[検索したい拡張子]" | LANG=C xargs grep -n -v '^[[:cntrl:][:print:]]*$' --binary-files=without-match
1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?