Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use vbs to calculate the number of times a word appears in a log file

Shulou Source: shulou.com Published: 2022-06-03 19:38:20 11月12日 Update

This article introduces the knowledge of "how to use vbs to calculate the number of times a word appears in a log file". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The copy code is as follows:

Const ForReading = 1 Set objFSO = CreateObject ("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile ("c:\ scripts\ test.log", ForReading) strContents = objFile.ReadAll objFile.Close I = 0 arrLines = Split (strContents, ") For Each strLine in arrLines If InStr (strLine "Failure") Then I = I + 1 End If Next Wscript.Echo "Number of failures:" & I "how to use vbs to calculate the number of occurrences of a word in a log file" ends here Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Files logs times code content more knowledge practicality achievement next dilemma reality situation articles cases editing websites industries processes high quality Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Shulou Technology Linux vpn Huawei