Need more efficient log file grep

I'm writing a script that at one point needs to check the contents of another script's log file to determine how to proceed. An example record from the log file is:

"mcref04152006","060417","ANTH0415","282","272","476,983.37","465,268.44","loaded"

I want my script to return this record if:

1.) the record contains "mcref", which is declared earlier in the script as $reffilepattern, and
2.) the record contains "060417", which is declared earlier in the script as $todayyymmdd.

I don't need to be picky about which fields contain the data, because the format is consistent. I'm presently doing this to read the entire line into the variable $loadedref:

todayyymmdd=$(date +%y%m%d)
reflog=reflogfile.txt
reffilepattern="mcref"
...
loadedref=$(grep "\"$todayyymmdd\"" $reflog | grep $reffilepattern)

Obviously, this works just fine, except that piping the results of one grep into another grep seems unholy. The log file is small, so while efficiency is not a concern at this point, it will be eventually as the log file grows. I tried to combine this into one grep that says, "give me the record that contains both "mcref" (without quotes) AND "060417" (with quotes), with any number of characters in between (including none)." I've tried goofy stuff like:

grep ${reffilepattern}[A-Za-z0-9]*\"${todayyymmdd}\" $reflog

...which doesn't work. Can anyone give me some pointers here? I know I'm missing something really simple -- it's late in the day! Thanks in advance.

I think what you have is fine. If your worried about performace then I suggest going to PERL. Perl is much faster and better at parsing files. It's what perl was meant for.

I was going to write the script but I got tired and I'm going home. I'll check back tomorrow.

-X

Would this work for you:

grep "${reffilepattern}.*${todayyymmdd}" $reflog

I tried on a test file with your data, seemed to work, let us know...

Interesting -- grep "${reffilepattern}.*${todayyymmdd}" $reflog works (I can't believe I didn't think of that), but on a larger test file (about 60MB) it is actually 2 to 3 times slower than the original method of piping one grep through another. I'm guessing because the first grep narrows the records down for the second grep. I guess I'll just keep my original method. Thanks for the help, though. This is good to know!