How to extract all IDs accessed from a mysql general log using the linux commandline?
- by shlomoid
This should be a trivial question for anyone who's good with bash/sed/awk. Unfortunately, I'm not, yet :)
I've got a general log from MySQL which contains some queries that have a common parameter, they query on a specific id field.
The queries look like
update tbl set col='binary_values' where id=X;
I need to process the log and extract all the IDs that these queries touched, each in it's own line.
The purpose of this is to figure out how many times each ID is accessed. Eventually I'd group and count the values.
The binary values are indeed binary junk, so they kinda messed up some things I've been trying to do.
Eventually we solved the problem temporarily using a python script, but I'm sure the linux command line tool set can do it too. How would you do it?