Hi there,
Being a newcomer to this great bit of software, could anyone tell me if it's possible for me to do the following.
I have a number (100s!) of web log files that have been incorrectly produced.
Example:
#Software: Microsoft Internet Information Server 4.0
#Version: 1.0
#Date: 2000-03-16 07:28:11
#Fields: time c-ip cs-username cs-method ....
07:28:11 193.149.83.224 - GET / - .....
07:28:32 193.149.83.224 ......
07:28:33 193.149.83.224 - ....
I need to append the date as it appears in line 3, to the begginning of all the other lines (not starting with #).
I've produced a macro in Textpad to find the date and copy it in, but I can find no way of applying this to all the open files I have. One at once would be a bit tedious...
I know find and replace can look at all files, but I don't know how to select the date in each file and then use it.
Any help would be greatly appreciated.
Andrew
Regular Expressions
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
David Kitchen
Re: Regular Expressions
Do the following:
F8 or Search > Replace
and turn on regular expressions in the search dialog.
you can now use a search such as :
'\n'
which will find the end of a line, and replacing with:
'\ndate '
will place the date at the beginning of all lines.
note that you need to run a further replace to remove the date from the lines that began with # and the last line of the file, but this is effortless too
cheers
F8 or Search > Replace
and turn on regular expressions in the search dialog.
you can now use a search such as :
'\n'
which will find the end of a line, and replacing with:
'\ndate '
will place the date at the beginning of all lines.
note that you need to run a further replace to remove the date from the lines that began with # and the last line of the file, but this is effortless too
cheers
-
Howard Hansen
Re: Regular Expressions
While I have faith that almost anything can be done with liberal doses of regular expressions, I don't know how to tackle this problem.
Actually, I do know how to tackle this problem. Microsoft has a DOS utility that can do log conversion for you and it supports *.log, etc. It's called Convlog.exe and you can find a download link from this page: <a href="http://support.microsoft.com/support/kb ... /29.asp</a>
Once you've downloaded the file, just open a DOS window, move to where you downloaded convlog, then type:
convlog /?
and you'll get the help message which will tell you how to use it.
Remember, you're not the first to have to do these things!
Good Luck!
Howard Hansen
http://howard.editthispage.com
Actually, I do know how to tackle this problem. Microsoft has a DOS utility that can do log conversion for you and it supports *.log, etc. It's called Convlog.exe and you can find a download link from this page: <a href="http://support.microsoft.com/support/kb ... /29.asp</a>
Once you've downloaded the file, just open a DOS window, move to where you downloaded convlog, then type:
convlog /?
and you'll get the help message which will tell you how to use it.
Remember, you're not the first to have to do these things!
Good Luck!
Howard Hansen
http://howard.editthispage.com