mwgrep: account for db names with underscores

To derive the dbname from the index name, split on the second-last underscore
rather than the first.

Bug: 64273
Change-Id: I841865da800971eee039f03ce85641cd8efe66db
Merge "mwgrep: account for db names with underscores" into production