Ilan.K
Ilan.K

Reputation: 718

using Linux command line to convert file character encoding

How can one change the file encoding from linux (Fedora 20) command line? I have a huge CSV file 7GB and I don't wish to open it.

Upvotes: 1

Views: 3969

Answers (1)

Ilan.K
Ilan.K

Reputation: 718

  1. open a console window or terminal...
  2. to find out the current encoding

file -bi /path/to/file.csv

the result should look something like

"text/plain; charset=us-ascii"
  1. now for the conversion:

iconv -f inputEncoding -t outputEncoding /path/to/input/file.txt -o path/to/output/file.txt

for example:

iconv -f iso-8859-1 -t utf8 ~/Documents/bigger_not_filtered.csv -o /tmp/utf8_bigger_not_filtered.csv

Upvotes: 2

Related Questions