Or you could use a more appropriate tool like sed.

Why would you ever write a C# application to do something so trivial ?



2008/12/20 AstroDrabb <[email protected]>:
>
> On Fri, Dec 19, 2008 at 10:24 PM, Joe Enos <[email protected]> wrote:
>>
>> You didn't mention how you're writing your output file...If you're
>> using a StreamWriter to write your output file, you should be able to
>> just do this by calling Write(textLine + "\n") instead of WriteLine
>> (textLine).  Don't know if you're working with StreamWriters, but
>> that's probably the easiest way I've found to work with large text
>> files.
>
> Thanks for the tips Joe.  I am using a StreamWriter.  I had about 2 hours
> to get this app together to fix the 700 MB flat file.
>
> One thing that was a concern was speed.  Some of the records/lines in the
> flat file are over 3,000 chars long.
>
> The old process was taking 6 hours.  I got it down to about 50 seconds.
>
> I guess I was looking for brownie points and didn't even think of just
> using Write() and append the type of EOL I wanted.  D'oh!
>
> I was more concerned with getting the speed of parsing and fixing
> the file down from 5-6 hours.
>
> Anyway, thanks for the kick-in-the-head Joe.  Very obvious fix,
> too focused on A to see how simple B is/was.
>
> This is why I love usenet/chat groups for developers.  One may be having a
> brain-fart, however odds are against all the other good devs on the list
> having a brain-fart as the same time.
>
> Jim
>

Reply via email to