Skip to content

Instantly share code, notes, and snippets.

@wai-doi
Last active April 6, 2018 06:38
Show Gist options
  • Save wai-doi/98090a078d1bed554787dcdbdc4e4a12 to your computer and use it in GitHub Desktop.
Save wai-doi/98090a078d1bed554787dcdbdc4e4a12 to your computer and use it in GitHub Desktop.
nkfコマンドの使い方
$nkf オプション ファイル [> 出力ファイル]
オプション一覧
-e           : EUCコードを出力
-s           : Shift-JISコードを出力
-w           : UTF-8コードを出力(BOM無し)
-g           : 自動判別の結果を表示
--overwrite  : 引数のファイルに直接上書き

文字コードを確認

$ nkf -g ファイル名

文字コード+改行文字を確認

$ nkf --guess ファイル名

UTF-8に文字コードを変更

$ nkf -w --overwrite ファイル名

改行文字をUnix形式に変換

$ nkf -Lu --overwrite ファイル名
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment