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

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

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

Post 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.
Sreedhar
Participant
Posts: 187
Joined: Mon Oct 30, 2006 12:16 am

Post by Sreedhar »

Hope this helps

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

row_count='wc -l $filename'

Regards,
Regards,
Shree
785-816-0728
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Post by somesh2suma »

hey sreedhar

thank you very much.
somesh2dsx
somesh2suma
Participant
Posts: 23
Joined: Wed Apr 08, 2009 5:28 am
Location: Bangalore

Post 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.
somesh2dsx
Post Reply