Maybe OT - Grepping the locate command

donn donn.ingle at gmail.com
Wed Mar 3 11:36:32 GMT 2010


On 03/03/2010 13:08, John McCabe-Dansted wrote:
> so we need something a bit longer like. locate *.ods | while read f ;
> do unzip -p $f | grep BLAH>  /dev/null &&  echo $f ; done

Groovy. I added quotes to handle weird filenames:
locate *.ods | while read f; do unzip -p "$f" | grep -i "gas" >/dev/null 
&& echo "$f"; done

Very nice. Thanks, and for the function tip too.

(In my prior experiments I somehow managed to zero *all* my .ods docs. 
Now I have to get them all from backup. Groan. Today bash really did!)

\d



More information about the sounder mailing list