SummaryLater summary The most elegant way to do this sort of thing definitely seems to be grepcidr. Had I known about it prior to trying to accomplish this task I definitely would have used it. I am going to mark the response that suggests using it as the answer, even though there are mutliple ways, including the sed commands and pipes I posted, to accomplish the same goal. The grepcidr command does have much greater adaptability for these sorts of tasks, as multiple address ranges can be specified far more easily than would be the case if attempting to use sed or grep.