Re: Bash Script for Beginners! oh dear :'(

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



On Tue, Dec 23, 2008 at 4:34 PM, Matej Cepl <mcepl@xxxxxxxxxx> wrote:
> On 2008-12-23, 12:15 GMT, James Bensley wrote:
>> find . -exec grep -q "$1" '{}' \; -print >> ./found_files
>
> I think you can have only one action (either -exec or -print),
> but not sure about it. Anyway, my first instinct when things are
> getting to be more complicated is to use while cycle, like this:
>
> find . |while read FILE ; do
>    if grep "$FILE" '{}' >/dev/null 2>&1 ; then
>        echo "$FILE" >> ./found_files
>    fi
> done
>

I don't think the '{}' construct for 'find' will work on the other
side of a pipe....

mhr
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux