I am working with a 50 Gb MySQL export file, and performing a list of scripting operations on it to convert to an SQLite3 loadable form (I got the leads from here : script to convert mysql dump sql file into format that can be imported into sqlite3 db ). I have not studied the structure of the MySQL dump, the data was got from a third party. I can see that it has create table and insert into statements, but given the size it is hard to manually read through and understand the structure. Piping the file through will not work because of the size. Also a bash script to load the file and then process line by line, such as
while read line
<do something>
complains that it is Out of Memory.
So I tried to pick each line, using awk or sed (both work), write the line to a file and then pass it through the list of perl scripts. This is the awk script I am using
$ awk -vvar="$x" 'NR==var{print;exit}' file > temp
where x holds the line number and then temp is sent through the perl commands and finally appended to the output file.
However, although fast initially, it quickly slows down as it starts having to iterate over an increasing number of lines from the start. There are about 40,000 lines.
Has anyone worked with something like this? Is there a faster way of doing this?