Results 1 to 5 of 5

Thread: Parsing large textfiles?

  1. #1

    Thread Starter
    Lively Member Blupig's Avatar
    Join Date
    Apr 2008
    Posts
    118

    Question Parsing large textfiles?

    Hello, I'm trying to do something very basic, though the fact that the text file I'm using is around 152mb in size makes it a bit harder.

    I'm trying to parse out HTML tags from the file. My Regex matching function tells me there are around 1100 HTML tags to take out (which isn't that many considering how big the file is), and the parsing function itself is multithreaded, though the program still freezes. I've even tried to compile it under x64, with no luck.

    So, how can I effectively parse huge files like that without having my program freeze and not work? The problem is not with my threading or my parsing, it's with the size of the file.

  2. #2
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: Parsing large textfiles?

    How are you parsing the file?

  3. #3

    Thread Starter
    Lively Member Blupig's Avatar
    Join Date
    Apr 2008
    Posts
    118

    Re: Parsing large textfiles?

    Quote Originally Posted by billboy View Post
    How are you parsing the file?
    Before I was just opening the file into a string then parsing the string and outputting it again. After some research I figured that I should try the same thing but line-by-line instead. It went a lot faster and didn't freeze, just trying to see if it worked properly or not.

  4. #4
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: Parsing large textfiles?

    Use stream reader, line by line should not freeze

  5. #5
    Frenzied Member circuits2's Avatar
    Join Date
    Sep 2006
    Location
    Kansas City, MO
    Posts
    1,027

    Re: Parsing large textfiles?

    This works for me, and I am reading text files that are hundreds of megabytes too.


    vb.net Code:
    1. Dim myFileReader As New StreamReader(ReadFilePath)
    2. Dim myLine As String = ""
    3. myLine = myFileReader.ReadLine()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width