Forrest logo
back to the nkf tool

nkf:tldr:497eb

nkf: Set new line code to CRLF and overwrite (windows type).
$ nkf -c --overwrite ${filename-txt}
try on your machine

The command "nkf -c --overwrite ${filename-txt}" is used to convert the character encoding of a text file to the Unicode UTF-8 format while overwriting the original file.

Here is a breakdown of the command:

  • "nkf" stands for "Network Kanji Filter," which is a command-line tool used for character encoding conversions.
  • "-c" is an option that tells nkf to convert the input to Unicode (UTF-8) character encoding.
  • "--overwrite" is an option that instructs nkf to overwrite the original file with the converted version. Without this option, nkf will create a new file with the converted content, leaving the original file unchanged.
  • "${filename-txt}" is a placeholder for the actual filename and extension of the text file you want to convert. You need to replace "${filename-txt}" with the actual name and extension of your file (e.g., "example.txt").

In summary, this command will convert the character encoding of the specified text file to UTF-8 format while replacing the original file with the converted version.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nkf tool