Page 1 of 1

want to compare size & count of 2 files through unix scr

Posted: Fri Jan 22, 2010 1:26 pm
by somesh2suma
hi

i am writing a script to compare file size of two files and also row count of 2 files, one is called as src1.data in Arrival directory with src1.OK file in Source directory. And if its not equal then it should exit with status fail.

Please let me know the logic and unix code for this functionality.

Thanks in advance.

Posted: Fri Jan 22, 2010 1:41 pm
by Sreedhar
Hope this helps

File_size=`ls -la | grep $filename | awk 'END { print $5 }'`

row_count='wc -l $filename'

Regards,

Posted: Sat Jan 23, 2010 4:19 am
by somesh2suma
hey sreedhar

thank you very much.

Posted: Sun Jan 24, 2010 10:09 pm
by somesh2suma
hey sreedhar,

Thank you very much,
Actually the below expr without END worked perfectly--

File_size=`ls -la | grep $filename | awk '{ print $5 }'`

It reduced lot of my time. Thanks again.