1
0

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 1 year has passed since last update.

ディレクトリ内のテキストファイルの改行コードをLFに統一(nkfコマンド)

Last updated at Posted at 2018-02-12

こんにちは
nkf コマンドを使ってディレクトリ内のファイルの改行コードをLFに統一しました(文字コードも)。

  • 誤動作していたコマンドも正常に動くようになりました(diff など)。
$ nkf --guess * | grep -e MIXED\ NL -e CR | awk -F: '{print $1}' | xargs nkf -Lu -d --overwrite
$ nkf --guess * | grep -e EUC-JP -e Shift_JIS | awk -F: '{print $1}' | xargs nkf -Lu --overwrite
$ nkf --guess * | awk '{$1=""; print $0}' | sort | uniq
 ASCII
 ASCII (LF)
 BINARY
 UTF-8 (LF)
1
0
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
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?