Fazil
Fazil

Reputation: 51

How to add cksum in find command

$ cksum sample.txt
2763733609 1659 sample.txt

$ find /usr/local/sqoop -printf '%i,%b,%M,%n,%u,%g,%s,%Tc,%h/%f'$'\n'
19404466,8,-rwxr-xr-x,1,hduser,hduser,1345,Monday 27 April 2015 12:12:36 PM IST,/usr/local/sqoop/conf/sqoop-env-template.sh

After file name I have to display cksum of the file in the above find command. How to do it.

Thanks in advance.

Regards, Abu

Upvotes: 0

Views: 279

Answers (1)

RomanPerekhrest
RomanPerekhrest

Reputation: 92904

find + cksum solution:

find /usr/local/sqoop -type f -printf '%i,%b,%M,%n,%u,%g,%s,%Tc,%h/%f,' \
-exec sh -c 'cksum {} | cut -d" " -f1' \;

Upvotes: 1

Related Questions