How to convert Windows filenames (from a checksums.md5) to *nix notation so I can use it on my shell with md5sum?

Posted by Somebody still uses you MS-DOS on Super User See other posts from Super User or by Somebody still uses you MS-DOS
Published on 2011-08-25T01:39:50Z Indexed on 2012/06/26 9:18 UTC
Read the original article Hit count: 281

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?

© Super User or respective owner

Related posts about Windows

Related posts about linux