compare two text files on single column

I've saved the output of two separate runs of 'ls -l' to two text files - file1 and file2.  The listing in file2 is a superset of file1.  I'd like to compare the contents of the two files based on column 7 only (filesize) to roughly find the lines in file2 which are not in file1.  I've tried several awk one liners but they fail so miserably that it doesn't make sense to post them here.
Thank you,
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Is filesize the only important value?  To compare entire lines, and only list the ones in file2 but not file1, use:

    comm -13 file1 file2
97WideGlideAuthor Commented:
Thanks for your response but my goal is to roughly find duplicate files based filesize so I would need to compare column 7 of each file only.
Field 7?  In my "ls -l" output, the size is field 5 - field 7 is the day of the month!

Anyway, the following awk script reads in the contents of file1 and stores all of the sizes in an array (larr).  It then reads in file2 line by line, and if the size of the file in file2 doesn't match the size of any files in file1, the entire line is printed out.
awk 'BEGIN{j=0; while (0 != getline l1 < "file1") {split(l1,l1s); larr[j++] = l1s[5]}}
{f=0; for (l in larr){if ($5 == larr[l]) f=1}; if (f == 0) print}' file2

Open in new window

Please change all 5s to 7s if your "ls" is different.  Also change the "file1" and file2 to match your file names ("file1" must be in double quotes like here, file2 doesn't have to be).

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
97WideGlideAuthor Commented:
Thank you!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.