Hi!
I have a BIG log file wich is about 60MB.
I whant to extract all the lines that contain the text "ERROR" and all the following lines until a "----------" is reached. This is appended to a ERROR.log file
I have this working but it takes a LOOOONG time. With a smal log file it is no problem.
I use the Windows XP command >find "ERROR" largefile.log.0 /N to get the line numbers of lines wich contains "ERROR". This is fairly fast.
Then i extract all the lines in this list + following lines until "-----" is encountered.
At first it is fast but when row numbers increase it gets slower and slower.
Any design ideas on how to do this faster?
Extracting text from BIG text file?
Moderators: JRL, Dorian (MJT support)
-
- Pro Scripter
- Posts: 149
- Joined: Tue Mar 23, 2004 9:11 pm
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
You don't provide any information as to how you are reading the file in. ReadLn will be very slow on big files. ReadFile would be much faster. See:
http://www.mjtnet.com/blog/2007/07/02/r ... in-memory/
Alternatively you can read text files with VBScript using the FileSystemObject and OpenTextFile (search for those on this forum).
http://www.mjtnet.com/blog/2007/07/02/r ... in-memory/
Alternatively you can read text files with VBScript using the FileSystemObject and OpenTextFile (search for those on this forum).
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?