Just a sample of the Echomail archive
[ << oldest | < older | list | newer > | newest >> ]
|  Message 417  |
|  Maurice Kinal to Alan Ianson  |
|  CRC32  |
|  30 Sep 16 10:08:50  |
 
-={ Friday, 30 September 2016, 03:08:50.904363019 -0700 }=-
Hey Alan!
AI> Do you happen to know if it's possible to use this utility to get
AI> a CRC-32 value for a file?
Yes. Try this;
cksum filename | cut -f1 -d' '
which will just output the checksum and trim off the byte count and filename.
AI> Example: Crc B0A29EE6
printf "Crc %x\n" $(cksum filename | cut -f1 -d' ')
However it will output without caps - Example: Crc 53a7b0cd
If that is an issue then something like this might be better;
echo "Crc $(printf "%x" $(cksum filename | cut -f1 -d' ') | tr '[:lower:]'
'[:upper:]')"
which will result in 'Crc 53A7B0CD' instead of 'Crc 53a7b0cd'. Looking at it
as a oneliner I am thinking gawk might be a better solution but then where is
the fun in that?
Life is good,
Maurice
... þa þurfon swiþe lytles, þe maran ne willniaþ þonne genoges.
They need very little who desire no more than enough.
--- GNU bash, version 4.4.0(1)-release (x86_64-atom-linux-gnu)
* Origin: Little Mikey's Brain - Ladysmith BC, Canada (1:153/7001.0)
|
[ << oldest | < older | list | newer > | newest >> ]