I am trying to get the base64 md5 value of the latest file in an oracle backup directory:
for file in "$(find /oracle/PD1/sapbackup/b*/ -newermt $date -type f)"; do openssl md5 -binary $file | base64 && echo $file >>/md5check/$date/PD1/md5local.txt; done
When I run this command I get the full md5 checksum: Y1l1t+SGpQ7Jh0GZm9R5oTrEvfcGM7NaCuYediMH2MY=
But I want to get the base64 value:
# openssl md5 -binary /oracle/PD1/sapbackup/beyrnmmq/cntrlPD1.dbf | base64
Y1l1t+SGpQ7Jh0GZm9R5oQ==
How can I do this using a for loop and output the file path + md5 value to a file?
Thanks!
`# cat /md5check/20180613/PD1/md5local.txt /oracle/PD1/sapbackup/beyrnmmq/cntrlPD1.dbf /oracle/PD1/sapbackup/beyrnmmq/BEYRNMMQ.INCR : md5 => [ 635975b7e486a50ec98741999bd479a13ac4bdf70633b35a0ae61e762307d8c6 ] / base64 => [ NjM1OTc1YjdlNDg2YTUwZWM5ODc0MTk5OWJkNDc5YTEgM2FjNGJkZjcwNjMzYjM1YTBhZTYxZTc2MjMwN2Q4YzYK ]` I can see what you are getting at though. It doesn't spit out the base64 value, but you are on the right track I believe. Any other suggestion? – user294040 Jun 13 '18 at 04:34