Microsoft
Software
Hardware
Network
Question : Extract date and part of the line from a log file
Hello Gurus
I have a log file (Web_out.log) that contains the following example lines
2010-07-27 00:00:00 [aaaaaaaaaa] ol/cvw/oihwHWEHVOWNSHHSHSH
SOhhhhhhhh
h - Exporting data using SQL: SELECT * FROM xxxxxxxxx
any old text here
2010-07-27 00:00:01any old text here
any old text here
any old text here
2010-07-27 00:00:01 [aaaaaaaaaa] ol/cvw/oihwHWEHVOWNSHHSHSH
SOhhhhhhhh
h - Exporting data to: :\ggggggggg\gggg\g
any old text here
any old text here
2010-07-27 00:01:30 [aaaaaaaaaa] ol/cvw/oihwHWEHVOWNSHHSHSH
SOhhhhhhhh
h - Exporting data using SQL: SELECT * FROM xxxxxxxxx
any old text here
2010-07-27 00:05:01 any old text here
any old text here
any old text here
2010-07-27 00:30:01any old text here
2010-07-27 00:34:21 [aaaaaaaaaa] ol/cvw/oihwHWEHVOWNSHHSHSH
SOhhhhhhhh
h - Exporting data to: :\ggggggggg\gggg\g
any old text here
I would like a vbs script that will select out the lines that contain "- Exporting data using SQL:" and "- Exporting data to:" and write then to a log file.
But I do not want the whole line to appear in the log, only the full timestamp and the "- Exporting data using SQL:" and "- Exporting data to:" parts of the line.
example log file (Web_out_results.txt)
2010-07-27 00:00:00 - Exporting data using SQL:
2010-07-27 00:00:01 - Exporting data to:
2010-07-27 00:01:30 - Exporting data using SQL:
2010-07-27 00:34:21 - Exporting data to:
Thanks for your help
Willyboy2
Answer : Extract date and part of the line from a log file
I've tested this in some of my projects and it works fine.
http://www.codeproject.com
/KB/IP/
Sen
ding_Email
s_From_GMA
IL.aspx
Hope that helps.
Random Solutions
SNMP on Server 2008
Unable to receive email forwarded into Lotus Domino 8 from Exchange Server 2007
Exchange 2003 and 2010 coexistent - Outlook in 2010 cannot email to 2003
Gridview RowSelected - Controlling state of other rows
return double array in Delphi call to c++
SSIS reuse the object variable
How to update Hyperlinks in Excel 2003?
How do I update file, save to new location and keep original file as is using Visual Basic 2008?
jQuery or JS - Checkbox set/unset in an array?
Setting up wireless on a Cisco 1811