D
Dan
I have a bunch of custom log files with database queries in them, and
would like to extract all the insert and update queries so I can
recreate some lost data.
I'm pretty sure this is the perfect exercise for a perl script. I
just don't have the vocabulary to write it myself. But this is all it
needs to do:
* Open, in order, all log files named yyyymmdd.log in the current
directory. (where yyyymmdd is what you think it is)
* For each file, look at each line, and if it begins with " query=
INSERT" or " query = UPDATE", write that entire line starting from the
word "INSERT" or "UPDATE" to the output file.
I'm not sure what version of perl I have or if that matters, but my
system is Fedora Core 2, so whatever comes with that...
Any takers? The 2 minutes of your time would be greatly appreciated.
would like to extract all the insert and update queries so I can
recreate some lost data.
I'm pretty sure this is the perfect exercise for a perl script. I
just don't have the vocabulary to write it myself. But this is all it
needs to do:
* Open, in order, all log files named yyyymmdd.log in the current
directory. (where yyyymmdd is what you think it is)
* For each file, look at each line, and if it begins with " query=
INSERT" or " query = UPDATE", write that entire line starting from the
word "INSERT" or "UPDATE" to the output file.
I'm not sure what version of perl I have or if that matters, but my
system is Fedora Core 2, so whatever comes with that...
Any takers? The 2 minutes of your time would be greatly appreciated.