Using sed/awk to print lines with matching pattern OR another matching pattern

The POSIX way

awk '/pattern1/ || /pattern2/{print}'

Edit

To be fair, I like lhf‘s way better via /pattern1|pattern2/ since it requires less typing for the same outcome. However, I should point out that this template cannot be used for logical AND operations, for that you need to use my template which is /pattern1/ && /pattern2/

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)