Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have some checksums.md5 verification files from an ntfs external drive, but using windows notation: \ instead of /, spaces between file names (not escaped), reserved shell characters (like (, &, ', to name a few).

The checksums.md5 has a bunch of checksums and filenames:

;Created by program
;2010

f12f75c1f2d1a658dc32ca6ef9ef3ffc  *My Windows & Files (2010)\[bak]\testing.wmv
53445e1a0821b790872e60bd7a166887  *My Windows Files' 2 (2012)\[bak]\testing.wmv
53445e1a0821b790872e60bd7a166887  *My Windows Files ˜nicóde (2012)\[bak]\testing.wmv
;Finished

I want to use this checksums.md5 to verify the files that I've copied to my machine: but I'm on a Linux, so I need to convert the names inside checksums.md5 from Windows to Linux to use the md5sum utility from the shell. The first line in my example would become:

f12f75c1f2d1a658dc32ca6ef9ef3ffc  My\ Windows\ \&\ Files\ \(2010\)/\[bak\]/testing.wmv

Is there some application for this (converting a file listing, from windows cmd notation, to linux shell notation) or will I need to create a bash script using sed that just "replaces" what is "wrong" with the filenames?

share|improve this question
    
What is it you're trying to verify? Is it the NTFS filesystem itself? – OldWolf Aug 25 '11 at 2:50
    
No, the files that were copied to the external ntfs drive had a md5 checksum, I'm copying them again to the machine and want to verify the checksums, but the checksums.md5 is using windows file listing notation and I need to convert it to *nix. I've edited the question with more information and a concrete example. – Somebody still uses you MS-DOS Aug 25 '11 at 3:08
2  
That's not "Windows cmd notation". If it were, the ampersand would be escaped with a caret. That's just the raw unadorned pathname. – JdeBP Aug 25 '11 at 7:22
up vote 2 down vote accepted
sed -i 's|\\|/|g' checksums.md5

The md5sum output format does not use any "shell notation" – neither cmd nor sh. Each line has exactly two fields (hash and filename) so no escaping should be required for file names.

The only difference is the usage of \ versus / as the path separator in different systems. (Most Windows programs accept / too.) Just replace all backslashes and you're done.

share|improve this answer
    
I needed to add "./" at the beginning of the line as well since the checksums aren't with the full path... but thanks. Since it wasn't working, I thought it was the special characters, but your answer made me look for other problems (that's why I marked it as accepted). Thanks. – Somebody still uses you MS-DOS Aug 26 '11 at 2:35

Not for nothing but md5deep is available for both Windows and Linux and it's 100% cross-platform compatible. Check it out on http://md5deep.sourceforge.net/

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .