Problems with opening large textfile ower 65000 lines

BomZai

New Member
Joined
Feb 24, 2002
Messages
2
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.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Yes BomZai it is possible :) :

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

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

- then import this IMPORT.TXT into Excel

This message was edited by Bruno on 2002-02-25 07:09
 
Last edited by a moderator:
Upvote 0
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... :(
 
Upvote 0
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>>>>
 
Upvote 0
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

VBA 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 ?


This message was edited by Bruno on 2002-02-26 00:41
 
Last edited by a moderator:
Upvote 0
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...
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,972
Members
448,537
Latest member
Et_Cetera

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top