Search code examples
md5checksum

Double space after MD5 Hash


I have a terminal command to execute an MD5 of a hard drive. However, this command only puts one space after the hash instead of the regular double space. I have provided the code below

find * -type f -exec md5 -r {} \\; > DRIVE.md5

Right now, what the code is doing is:

12345678912345678912345678912345 Test Files/Test Files.mov

What I want is for it to do:

12345678912345678912345678912345  Test Files/Test Files.mov

If I use this code:

find * -type f -exec md5 -r {} \\; | sed 's/ /  /g' > DRIVE.md5

It will add the double space after the Hash, but it will also add a double space between any space. Example:

Original:

12345678912345678912345678912345 Test Files/Test Files.mov

Result:

12345678912345678912345678912345  Test  Files/Test  Files.mov

Anyway help is greatly appreciated!


Solution

  • yes you could use sed in this way:

    find * -type f -exec md5 -r "{}" \; | sed 's/ /  /' > DRIVE.md5
    

    modifying the first space after the md5.