LoginSignup
4
3

More than 5 years have passed since last update.

ターミナルからテキストファイルの文字コードをUTF-8やShift_JISに変換

Last updated at Posted at 2016-04-19

Microsoft OfficeのExcelはShift_JISのcsvデータを開くことができません。UTF-8のcsvを開くと文字化けしてしまいます。

Excelしか開くことができない人に対しては、下記のコマンドでUTF-8からShift_JISに変換してから送付しています。

# shift-jis変換
find . -name '*.csv' | xargs nkf --overwrite -s

逆はこちら

#utf-8変換
find . -name '*.csv' | xargs nkf --overwrite -w

Macだとデフォルトでnkfが入っていないので下記のコマンドでインストールしてください。

brew install nkf      
4
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
4
3