[LINUX] Character code conversion. There is no nfk. Alternative with iconv and tr

There was a similar article and a detailed article (detailed link), but it is described as a reminder

background

--File processing on linux --I don't know the contents because it is a file (sjis) for windows --nkf has not been introduced (cannot be introduced without permission)

Instead of introducing nkf, conversion with iconv and tr commands was performed.

What i did

--iconv also converts character code (sjis → utf8) --Delete line feed code with tr (windows line feed code \ n \ r → \ n) Delete \ r

Conversion from sjis to utf8


 iconv -f SHIFT-JIS -t UTF-8 sjis file name| tr -d ¥¥r >File name after utf8 conversion

Related Links

It is described in detail. I wanted to find it sooner. Linux [nkf, iconv] character & line feed code conversion [Iconv] command-convert character code [Tr] command-replace / delete characters in text file

Recommended Posts

Character code conversion. There is no nfk. Alternative with iconv and tr
Addicted to character code by inserting and extracting data with SQLAlchemy