Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 6 of 6

Thread: Problems with opening large textfile ower 65000 lines

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    are there possible to open a text-file larger than 65000 lines and find out how many times a specific word accords in the text-file? and then inport thet number into exel.

    need to make a progrem that reads large log-files.

  2. #2
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes BomZai it is possible :

    - go to the MS-DOS prompt
    - go to the folder with the large text file
    - enter the following command :
        FIND /N /I "word_to_search" file_to_search  > import.txt 


    example, search for the text 'www' in the text file 'internet.txt' :
         FIND /N /I "www" internet.txt  > import.txt 


    - then import this IMPORT.TXT into Excel
    _________________


    Bruno


    [ This Message was edited by: Bruno on 2002-02-25 07:09 ]

  3. #3
    Guest

    Default

    But I will stil get the problem because the hits are now about 58000 and stil growing. so this will only help me for a litle time.
    im loking for a macro that does the job of counting the words.I made a macro that imports the lines from MSword an cheks for the selected word, but the macro is to slow. 5 hours to reed 70000 lines...

  4. #4
    Board Regular
    Join Date
    Feb 2002
    Posts
    3,184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I guess you are using a loop if so it will be SLOOOOOOW

    Need to select the colum or row what ever and demand excel DOES as you require, but hard to say more without seeing / knowing what you really are dealing with.

    HTH

    PS can yoy not s[lit th log file into sheet 1 and 2>>>>

    Free Excel based Web Toolbar available here.

    Jack in the UK
    J & R Excel Solutions
    "making Excel work for you"

  5. #5
    Board Regular Bruno's Avatar
    Join Date
    Feb 2002
    Location
    Flanders
    Posts
    484
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    BomZai, if you only want to know the number of times a certain word occurs in a certain text file, you could try this :

    - create new text file on your desktop
    - edit the text file a paste this code


    'Return number of times a string occurs in a text file.

    Dim fso, f
    Source_file= "c:internet.txt"
    Word_to_search= "www"
    pointer=1

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile(Source_file, 1, True)

    do while f.AtEndOfStream <> True
    pointer=1
    MyText=f.ReadLine
    do while instr(pointer,MyText,word_to_search) > 0
    'msgbox MyText & vblf & instr(pointer,MyText,word_to_search)
    pointer=instr(pointer,MyText,word_to_search)+1
    counter=counter+1
    loop
    loop

    f.Close
    msgbox "The text " &chr(34) &Word_to_search&chr(34) &" occurs " & counter & " times in the file "&chr(34) & Source_file&chr(34)



    - adjust the variables Source_file and Word_to_search
    - save the file
    - rename the file ending with .vbs (for example "Count.vbs")
    - now dubbleclick on this vbs-file to start it and wait...
    It requires some string manipulation so I don't know how long you will have to wait.
    Please let me know ?


    _________________


    Bruno


    [ This Message was edited by: Bruno on 2002-02-26 00:41 ]

  6. #6
    New Member
    Join Date
    Feb 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanx Bruno, it seems that this did solve my problem, It takes about 15 sec to scan trough the txt-file. And the macro works fine

    Thanx again, you saved me for a lot of time...

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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