Problem with cut command

Hi!

I get a md5 hash of a file with this command:

openssl md5 /Users/me/MyLogo.png | cut -f 2 -d ' '

"cut" because I just want the hash. But there is a problem -> that doen't work with a path with spaces:

openssl md5 /Users/me/MyLogo 2.png | cut -f 2 -d ' '

The result is "2.png)=" ... because of the space in the file name and the space is my delimiter.

How can I solve this problem? Any ideas?

Dirk

Try:

openssl md5 /Users/me/MyLogo 2.png | awk '{print $NF}'
1 Like