[wplug] bash question

terry mcintyre terrymcintyre at yahoo.com
Fri Nov 30 18:21:21 EST 2007


One variation is:

find . -name '*.txt' -exec grep -H foo {} \;

the -H argument prints the filename; delete if you wish.

Another possibility is:

 for i in *.txt ; do grep -H foo $i ; done 


Terry McIntyre <terrymcintyre at yahoo.com>
They mean to govern well; but they mean to govern. They promise to be kind masters; but they mean to be masters. -- Daniel Webster

----- Original Message ----
From: Zach <netrek at gmail.com>
To: General user list <wplug at wplug.org>
Sent: Friday, November 30, 2007 3:02:36 PM
Subject: [wplug] bash question


Hi,

I have a dir with about 3GB worth of text files (over 900 files) and
want to run the command "foo" on each one, it does some advanced
grepping basically. Anyone know how to do this? I was trying "for i
in..." but can't seem to get the syntax right.

Zach
_______________________________________________
wplug mailing list
wplug at wplug.org
http://www.wplug.org/mailman/listinfo/wplug






      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.wplug.org/pipermail/wplug/attachments/20071130/a8c48da2/attachment.html


More information about the wplug mailing list