[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [OT] Línea de comandos



On Fri, Feb 27, 2009 at 03:52:15AM -0200, Mauro Lizaur wrote:
> On Fri, 27 Feb 2009, Olaf Reitmaier Veracierta wrote:
> 
> >    De acuerdo,
> > 
> >    5 ineditos pero utiles...
> > 
> 
> >    5.- Buscar que archivos "*.htm" contienen las frase o palabra palabra
> >    "body" en el directorio actual
> > 
> >    for a in `find . -type f -name *.htm`; do if [ `cat $a | grep "body" | wc
> >    -l` -gt 1 ]; then echo $a; fi; done
> > 
> 
> pero no es mas facil asi?:
> 
> grep body *.htm* -R|cut -d':' -f1|uniq 

Te ahorras el uso de cut con el mismo grep:

$ grep -ilR "body" *.htm*

Y con find es aún más poderoso:

$ find . -type f -iname "*.htm*" -exec grep -il "body" {} \;

Saludos.

PS: Olaf, envía tus mensajes sin HTML, por favor.

-- 
Pablo Jiménez


Reply to: