Iconv for large files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Iconv for large files
# 1  
Old 06-18-2015
Iconv for large files

Hi

I am using iconv command to convert the encoding of files.
Below is the command used:
Code:
iconv -f UCS-2 -t UTF-8 inputfile.txt> outputfile.txt

The command is working fine for files less than 2GB.
When I try converting the files of more than 2GB size I get an error as 'Can't open file'. I now understand that iconv will not be able to convert huge files.
I am using ksh shell
Can someone provide a solution to this.

Thank you in advance.
vrcr

Last edited by jim mcnamara; 06-18-2015 at 11:32 PM..
# 2  
Old 06-18-2015
iconv on your system appears not to support largefiles.

There is an approach called chunking - try this:
https://github.com/mla/iconv-chunks

It is a perl that allows iconv to process 100MB chunks of gigantic files and output to stdout - you redirect to the new file.

Last edited by jim mcnamara; 06-18-2015 at 11:43 PM..
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 06-19-2015
Unless the utility in question needs to move around within the file (as opposed to just processing text from the start of the file to the end of the file), you can frequently get by much more simply by just redirecting the input file (so the shell opens the file for the utility instead of the utility opening the file itself):
Code:
iconv -f UCS-2 -t UTF-8 < inputfile.txt > outputfile.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Iconv on large files

Hi All, I am using iconv to convert huge files. the process is getting killed. I tried the option in below link https://www.unix.com/shell-programming-and-scripting/258825-iconv-large-files.html i.e iconv -f UCS-2 -t UTF-8 < inputfile.txt > outputfile.txt However, the process still gets... (4 Replies)
Discussion started by: tostay2003
4 Replies

2. Shell Programming and Scripting

Help with command iconv

I need to convert a utf16 file to utf8. When i use the iconv command to do so it gives an error saying invalid function. When I ran the iconv -l function it did not list the utf16 and utf8 as part of its internal table. Is there anyway I can add these encodings in the library? Is there any other... (3 Replies)
Discussion started by: gaun
3 Replies

3. AIX

Installing Converter files for iconv conversion

Hi Friends, I need to install two converter packages UTF-8_IBM-284 and UTF-8_IBM-500 in the location /usr/lib/nls/loc/iconv/* or /usr/lib/nls/loc/iconvTable/* . Could you please let me know how to get this converter files. Thanks in Advance, Siva. (1 Reply)
Discussion started by: sivakumarl
1 Replies

4. UNIX for Dummies Questions & Answers

Help with iconv command

Hi , I am using iconv command to convert a file in UTF-16 format to UTF-8 format. This command will work for few files but for some showing an error as bad input character. But if i copy the contents of the file for which it is showing "bad input character" to a new file and perform the... (2 Replies)
Discussion started by: Shruthi8818
2 Replies

5. Shell Programming and Scripting

Help with iconv command

Hi , I am using iconv command to convert a file in UTF-16 format to UTF-8 format. This command will work for few files but for some showing an error as bad input character. But if i copy the contents of the file for which it is showing "bad input character" to a new file and perform the... (0 Replies)
Discussion started by: Shruthi8818
0 Replies

6. Solaris

How to safely copy full filesystems with large files (10Gb files)

Hello everyone. Need some help copying a filesystem. The situation is this: I have an oracle DB mounted on /u01 and need to copy it to /u02. /u01 is 500 Gb and /u02 is 300 Gb. The size used on /u01 is 187 Gb. This is running on solaris 9 and both filesystems are UFS. I have tried to do it using:... (14 Replies)
Discussion started by: dragonov7
14 Replies

7. Shell Programming and Scripting

Divide large data files into smaller files

Hello everyone! I have 2 types of files in the following format: 1) *.fa >1234 ...some text... >2345 ...some text... >3456 ...some text... . . . . 2) *.info >1234 (7 Replies)
Discussion started by: ad23
7 Replies

8. UNIX for Advanced & Expert Users

iconv and xmllint

Here is my question, volume of records processed : 5M ( approx ) Its basically very simple operation that am trying to do and I had achieved the output that am interested. What am looking for really is to improve the performance, an optimized way to do that. with respect to iconv, am... (3 Replies)
Discussion started by: matrixmadhan
3 Replies

9. UNIX for Dummies Questions & Answers

large files?

How do we check 'large files' is enabled on a Unix box -- HP-UX B11.11 (2 Replies)
Discussion started by: ranj@chn
2 Replies

10. Programming

about iconv

I want to use iconv.h to convert some text to another charset. The code is below: #include <stdio.h> #include <stdlib.h> #include <iconv.h> int main() { iconv_t cd; char instr="汉字"; char *inbuf; char *outbuf; unsigned int insize=7; ... (4 Replies)
Discussion started by: yong
4 Replies
Login or Register to Ask a Question

Featured Tech Videos