1
I have a large file that contains records in multilines. ex:
domain1 NS ns1
domain1 NS ns2
domain1 NS ns3
domain2 NS dnsx
What might be the fastest way to generate a CSV of the form
domain1,ns1,ns2,ns3
domain2, dnsx
I have tried php and groovy scripts but the processor load time is too high for a file (read) of a 1Gb file (and a consequent write to a csv file).
I am thinking there should be a better programatic approach than what I am doing. Basically I am creating a list/array to contain records and check against the last element if the same domain is found in the current line being checked.
P.S Mentioned groovy/php, but response may have no relation to these specific scripting languages.
Is the file already sorted by domain? Or at least, are all the records with the same domain grouped together? – glenn jackman – 2015-10-07T20:56:54.517
They are sorted. – Armand – 2015-10-08T07:28:22.240