1

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.

1 Answer 1

2
  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

Sign up to request clarification or add additional context in comments.

3 Comments

Note that file can only give you a best guess for the encoding. You should know what your files are encoded in based on some specification or meta data. If you don't and you need charset detection, you need to employ heuristics, or human eyeballing.
You have to set the output file with the -o argument.
thanks @MarcelPfeiffer, i updated the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.