# nkf --help Usage: nkf -[flags] [--] [in file] .. [out file for -O flag] j/s/e/w Specify output encoding ISO-2022-JP, Shift_JIS, EUC-JP UTF options is -w[8[0],{16,32}[{B,L}[0]]] J/S/E/W Specify input encoding ISO-2022-JP, Shift_JIS, EUC-JP UTF option is -W[8,[16,32][B,L]] L[uwm] Line mode u:LF w:CRLF m:CR (DEFAULT noconversion) --overwrite[=SUF] Preserve timestamp of original files -g --guess Guess the input code -v --version Print the version --help/-V Print this help / configuration
# man nkf Specify input and output encodings. Upper case is input. -J ISO-2022-JP (JIS code). -S Shift_JIS and JIS X 0201 kana. EUC-JP is recognized as X0201 kana. Without -x flag, JIS X 0201 Katakana (a.k.a.halfwidth kana) is converted into JIS X 0208. If you use Windows, see Windows-31J (CP932). -E EUC-JP. -W UTF-8N. -L[uwm] -d -c Convert line breaks. -Lu -d unix (LF) -Lw -c windows (CRLF) -Lm mac (CR)
$ nkf -g test.txt UTF-8
nkf -w -Lu --overwrite test.txt
# nkf -e -Lu utf8.txt > euc-jp.txt # nkf -ed utf8.txt > euc-jp.txt -Lu = -d
nkf -s -Lw --overwrite test.txt
# To UTF8 find . -type f -name "*sh*" -print0 | xargs -0 nkf --overwrite -w -Lu