backwards compatible grep for memory

Potentially will work for 5.5 and earlier, as well as 6 and 6.5 (tested with 6.5)