filter each line of linux bash output by regexp

bash, linux, unix

Solution

cat file | grep pattern

You could also just use `grep pattern file` if it's a static file.

Problem

I want to filter the output of arbitrary output e.g. `cat` or `objdump` to only display lines which contain "pattern". Is there a one-liner UNIX/Linux command to do this? e.g. `cat filepath | xargs grep 'pattern' -l` is not working for me

Original source