打印与图案匹配的线条(PCRE grep)

perl -ne'print if /foo/' file.txt

不区分大小写:

perl -ne'print if /foo/i' file.txt