I have a list of files in a folder ~/wrx36/tmp
I want to produce a report, like below, for each file in the folder:
Filename, crc32_value
Which command / tools I should use?
I have a list of files in a folder ~/wrx36/tmp
I want to produce a report, like below, for each file in the folder:
Filename, crc32_value
Which command / tools I should use?
You can use cksum
from GNU coreutils to get CRC32 checksums (in decimal), and awk
, sed
, or other programming languages to modify the output.
Example with awk:
cksum ~/wrx36/tmp/* | awk '{print $3 ", " $1}'
Note this example does not correctly handle filenames with spaces/newlines.
cksum "filename" |awk '{cksum=$1; $1=$2="";gsub(/^[ \t]+/,"",$0);printf("\"%s\",%d\n",$0,cksum)}'