basic grep-like functionality