perl -MFile::Find -ne 'find(& sub { $f = 1; if (/pat/ and $f) { $f = 0; print $File::Find::name . "\n" }, "mydir");'