Taking Grep to a Lower Level

Página superior
Adjuntos:
Obtener este mensaje como un correo
+ (text/plain)
Eliminar este mensaje
Responder a este mensaje
Autor: G.D.Thurman
Fecha:  
Asunto: Taking Grep to a Lower Level
# list the name of files containing the pattern foo
# should work on sh, bash and ksh

for fname in `find . -type f 2>/dev/null` ; do
file $fname 2>/dev/null | grep text 1>/dev/null 2>&1 && grep -l foo $fname
done

# manpage for 'file' indicates that most files that can be displayed
# on a screen will have the word "text in their description