Results 1 to 6 of 6

Thread: Need way to look at specific line in text file. Tricky

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    Anyone know of a good package that will open a text file and display the line number you are looking at????? Be great if it was free (Not to the programmer though)???


    I have a text file with 100,000 records. I try and pull it into a SQL server but it errors out and gives me the line number (83,001). However, I do not have a way to look at that line to see what the problem is. I had someone with AS400 access pull the file in and for some reason the AS400 will do it and not error. He looked at line 83,001 and it indeed had a problem with respect to bad quote marks. I want to be able to fix the problem myself rather than having him take this step every week when a new text file arrives. I am looking to correct the text file at the source but would like a fix in the mean time.

    If I try and use the LINE INPUT function it can not open file and errors out. I believe because it is to large.

    Thanks

  2. #2
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    Try and load it into MS Word in .TXT format and then change line 83,001 and then do a Save As and make the file type .TXT instead of the Word format. Or get a util to split the file, fix the error, and re-join the file.

    If you are doing it in VB create a form with a RichTextBox & load the file into the RichTextBox and make sure that your Save code for the RichTextBox is specified to be a TEXT file like so:

    RichTextBoxName.SaveFile yourfile, rtfText

    The RichTextBox is a "Bottomless" text box.

    Hope this helps...

    ...later

  3. #3
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    Oops..forgot...load the text file into the RichTextBox like so:

    RichTextBoxName.LoadFile "c:\yourfile.txt", rtfText

    make your changes like a regular text editor and then call the save code like in the above message.

    ....later

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    Thanks for the reply.

    First: I can open it in Microsft word but that does not give me the line number. It will tell me what line I am on in the page but then it starts over when you move to the next page. The problem is just that, how do I get to line 83,001. If I could get to line 83,001 then I could fix it.

    Second: It will not open the file in VB because it is to big. Anyway I get an error when I try and do it.


  5. #5
    Hyperactive Member mikef's Avatar
    Join Date
    Jun 2000
    Location
    Beach bound...
    Posts
    510
    Take the number of lines per page and use this formula

    80(lines perpage) * 1038(pages) = 83040 lines

    That means line 83,001 is somewhere on page 1038....if there is 80 lines per page.

    ...later

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Sep 1999
    Posts
    154
    I found a text editor out there called textpad. Thanks for your suggestions.

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