windows ubuntu 子系统上的 iconv

iconv on windows ubuntu subsystem

我下载了一个巨大的 csv 文件 (7,98 Gio),以便将其导入到 postgres 数据库中。问题是文件是用 ISO-8859 编码的,如果我想在 postgres 上导入它,它必须是 UTF-8。

所以我尝试在 Ubuntu 子系统(集成在 Windows 10 中)上使用 iconv 命令将其转换为 utf-8。问题是根据输出文件的属性 window,输出文件仍然是空的。在按下 Ctrl+C 之前,命令不会终止。

这是我的命令:

iconv -t utf-8 < sirc-17804_9075_14209_201612_L_M_20170104_171522721.csv > xaus.csv

我尝试了很多语法,但 none 的主题正在填充输出文件...

P-S 对不起我的英语我是法国人

编辑:很长一段时间后命令输出:

iconv: unable to allocate buffer for input: Cannot allocate memory

iconv 看起来是想把整个文件加载到内存中,这对大文件来说可能会有问题。有关可能的解决方案,请参阅 iconv-chunks;来自 iconv-chunks 描述:

This script is just a wrapper that processes the input file in manageable chunks and writes it to standard output.