标准选项grep -l
(即小写L)可以做到这一点.
从Unix standard人中:
-l
(The letter ell.) Write only the names of files containing selected
lines to standard output. Pathnames are written once per file searched.
If the standard input is searched, a pathname of (standard input) will
be written, in the POSIX locale. In other locales, standard input may be
replaced by something more appropriate in those locales.
在这种情况下,您也不需要-H
.
中的换行符