#!/bin/bash
s='aaa
bbb
ccc
ddd
eee
fff
ggg'
sed -nE '/aaa|bbb/p' <<< "$s"