The for loop assigns as value to the stated variable each time thru the loop.
General syntax:
for <variablename> in <expression>; do
<stuff to do>
done
<expression> can be as simple as the "*" (in this context meaning "everything I can see") or it can be the result of a command
Suppose you wanted only the files with names starting with "G". The loop would start with:
for <variablename> in $(ls|grep "^G")
For more on BASH scripting, head over to
http://tldp.org and get the Bash Guide for Beginners