salida grep para mostrar solo el archivo coincidente


¿Cuál es la opción para grep que me permitirá solo imprimir el archivo coincidente y no la línea dentro de un archivo que coincida con los criterios?

 162
Author: codeforester, 2010-10-11

3 answers

grep -l 

(Es una L minúscula)

 251
Author: a'r,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-03-12 22:54:43

Puede usar el conmutador de estilo Unix -l-típicamente conciso y críptico – o el equivalente --files-with-matches – más largo y más legible.

La salida de grep --help no es fácil de leer, pero está ahí:

-l, --files-with-matches  print only names of FILEs containing matches
 32
Author: Iain Samuel McLean Elder,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-11-26 17:27:30

-l (es una L minúscula).

 23
Author: Mark Ransom,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-11 16:38:04