Hi everyone,

I am messing with a script and I run into a problem (would you otherwise
hear from me?)

The problem:

I receive a bunch of files at time. Depending on certain keywords in the
file I need to move these files to specific location.

My attempt:

for a in * ; do

        if [ 'grep -cif okfiles $a > 0 ' ] ; then
            echo Move $a! ;
        fi

done

Clearly this does not work. The grep within the if [] does not cut it. I
know the grep itself is working (-c for counting the occurence, -i for
ignoring case, and -f okfiles to use 'okfiles' as the source of correct
keywords. All files that have one of the keywords in them, listed in
okfiles, has to be moved. But the test does not work. It's probably
something simple that I miss.

I also tried 

 [ 'grep -cif okfiles $a ' > 0 ]
and
 [ 'grep -cif okfiles $a' ] > 0

but no good. Can someone help me with this one?
Thanks!

Paul

--
Q: What do you call a boomerang that doesn't come back?
A: A stick.

http://nlpagan.net - ICQ 147208 - Registered Linux User 174403
              -=PINE 4.21 on Linux Mandrake 7.1=-


Reply via email to