I want to read the content(file.gz) line by line,the following code is not friendly to large files of hundreds of Gb, and the memory overhead is also very large.

import std.stdio;
import std.process;
import std.string;

void main(string[] args){

        string fileName = args[1];
        string command = "gzip -dc " ~ fileName ;
        auto dmd = executeShell(command);

        if(dmd.status != 0){
                writeln("Compilation failed:\n", dmd.output);
        }
        else{
                auto all=chomp(dmd.output).split("\n");
            writeln(typeid(all));
            for(int i=0; i<all.length; i++){
                    writeln(all[i]);
                }
        }

}

Reply via email to