0
$ 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

RomanPerekhrest
  • 88,541
  • 4
  • 65
  • 105
Fazil
  • 51
  • 2
  • 4

1 Answers1

1

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' \;
RomanPerekhrest
  • 88,541
  • 4
  • 65
  • 105
  • @Fazil, what do you mean? You've specified a concrete path `/usr/local/sqoop` - why do you ask about "parent directory" now? – RomanPerekhrest Feb 26 '18 at 16:33
  • How to make comma seperated data for cksum find hadoop-3.0.0 -type f | xargs cksum 2840095922 951 hadoop-3.0.0/etc/hadoop/mapred-env.cmd I have to make the result set as comma seperated like below 2840095922,951,hadoop-3.0.0/etc/hadoop/mapred-env.cmd How to do it Thanks in advance. – Fazil Feb 26 '18 at 17:03