Sorting/Filed Defining/Output problem

need a little help with a few tid bits. I wrote a script that checks the resoluion of image files and writes them out to a file then sorts the resolutions by largets Width. Then take the sorted files information and toss all the 835 widths into a seperate file. Ignore the redundancies its a nesscearry evil. What I cannot get it to do is print the Filename along with the resolution.

identify -verbose *.|awk '/Geometry/{print($2)}'|awk -Fx '{print("*. : "($1"x"$2))}'> /home/Main/resolution.txt
sort -n /home/Main/resolution.txt > /home/Main/sortres.txt
grep 835 /home/Main/sortres.txt > /home/Main/finalsort.txt

I used *.* to cover all of the images in the diectory, which is where I am running into problems. Since I used *.* I cannot seeme to print the file name along with the resolution. If there is a simpler way that my mind is not seeing or a different way to force identify to read all the images and spit out thier resolutions and name into a file let me know.

Something like this,

while read filename
do
echo "Processing file $filename" > <outputfilename>
<your image processing command> $filename | <further operations>   >> <output filename>
done < list_of_files_to_process