$ perl -e 'm/foo/i && print while <>' i was foo i was foo i was fee i was foolish i was foolish ^D $