MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Feb 25th, 2002, 07:48 AM   #1
BomZai
New Member
 
Join Date: Feb 2002
Posts: 2
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.
BomZai is offline   Reply With Quote
Old Feb 25th, 2002, 08:07 AM   #2
Bruno
Board Regular
 
Bruno's Avatar
 
Join Date: Feb 2002
Posts: 468
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 ]
Bruno is offline   Reply With Quote
Old Feb 25th, 2002, 11:00 AM   #3
Guest
 
Posts: n/a
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...
  Reply With Quote
Old Feb 25th, 2002, 12:23 PM   #4
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
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"
Jack in the UK is online now   Reply With Quote
Old Feb 26th, 2002, 01:40 AM   #5
Bruno
Board Regular
 
Bruno's Avatar
 
Join Date: Feb 2002
Posts: 468
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 ]
Bruno is offline   Reply With Quote
Old Feb 26th, 2002, 05:16 AM   #6
BomZai
New Member
 
Join Date: Feb 2002
Posts: 2
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...
BomZai is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 08:28 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes