[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: md5 without MD5 ("OpenBSD") =
On 2001-09-02 at 13:51 -0700, Camille Davis wrote:
> Anyone know how to get the md5 command to return JUST the md5 string, NOT
> the other junk?
>
> $ md5 -s "OpenBSD"
> MD5 ("OpenBSD") = 760be6e1c2192a5bf7c0df47cc5f71ca
>
> I just want
> 760be6e1c2192a5bf7c0df47cc5f71ca
Several people have given solutions which use the fourth field. This
breaks if the filename has embedded whitespace.
Ultimate paranoia:
md5 file_name | tail -1 | awk '{print $NF}'
or:
perl <file_name -MDigest::MD5 -le \
'$c=Digest::MD5->new; $c->addfile(STDIN); print $c->hexdigest'
Either of which _should_ cope with arbitrary characters in filenames. I
think.
--
There are two major products that come out of Berkeley: LSD and UNIX.
We don't believe this to be a coincidence. -- Jeremy S. Anderson
[demime 0.98d removed an attachment of type application/pgp-signature]