xorl has asked for the wisdom of the Perl Monks concerning the following question:
So I have this rather large datafile. Unfortunately it somehow got corrupted. There are random newlines all over it. And what really should be the new line char is a +. What should be the record separator has turned into one of three different characters. Personally I don't believe the data is even correct, but the boss says to try and recover it anyway.
So I was thinking of doing something like open the file, loop through it and chomp out the newlines and stuff that all into a variable. Then do a regex (or probably more than one) on that variable to replace the chars. Then finally write that variable out to the output file.
The thing is we're looking at a pretty large file and stuffing that much data into a single variable seems like a pretty good way of crashing my box.
So are there any better ways of doing this?
Thanks in advance.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: scalable chomping
by ccn (Vicar) on Oct 29, 2008 at 14:02 UTC | |
by TGI (Parson) on Oct 29, 2008 at 17:14 UTC | |
Re: scalable chomping
by mpeever (Friar) on Oct 29, 2008 at 14:14 UTC | |
Re: scalable chomping
by NiJo (Friar) on Oct 29, 2008 at 18:45 UTC | |
Re: scalable chomping
by picabotwo (Initiate) on Oct 29, 2008 at 20:58 UTC | |
Re: scalable chomping
by brycen (Monk) on Oct 30, 2008 at 23:37 UTC |
Back to
Seekers of Perl Wisdom