|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Loop through Text File -Find String - Delete Line
Hey all
Im having some trouble with a VB script and was told this is the place to go for help. What I have is an IIS log that I would like to alter for an easier report for my Sup's to view. It looks like this below Code:
2005-03-21 00:00:38 10.150.111.111 - 10.150.111.111 80 GET /robohelp/SHPSMATE/SHPSMATE+v3/news.asp - 304 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) The problem is this page is set to refresh once a minute and is used by about 1000 people so my log is just overrun with it. What I would like to do is run a VB script that will open the file(its been converted to a text file) loop through it searching for a string that contains "news.asp" regardless of the time or IP connecting and then delete that entire string out of the file Problem is Im a little lost Ive been reading up and found that InStr option will be little help and everyone seems to be pointing me to a VB option does anyone have a good idea on how I could start this out Thanks a bunch in advance for any help |
|
#2
|
||||
|
||||
|
Open .log file with notepad to save as text(or just rename it)
Open .txt file with wordpad and save as rich text format(.rtf) Open With word and hit "ctrl+F" and got to replace tab copy example string and paste in find box To eliminate all lines regarding a certain file regardless of the user or time I did this Code:
Instead of 2005-03-21 00:00:38 10.150.111.111 - 10.150.111.111 80 GET /robohelp/SHPSMATE/SHPSMATE+v3/news.asp - 304 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) I used 2005-03-21 ^#^#:^#^#:^#^# 10.150.^#^#^#.^#^#^# - 10.150.111.111 80 GET /robohelp/SHPSMATE/SHPSMATE+v3/news.asp - 304 Mozilla/4.0+(compatible;+MSIE+6.0;+Windows+NT+5.1) "^#" means any number "^?" means any character Save open in wordpad save as .txt rename to .log good stuff This is totally Office relevant and is Used with IIS Logs but its an easy find and replace Like I said any other suggestions would be appreciated |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Loop through Text File -Find String - Delete Line |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|