Results 1 to 3 of 3
Hello all,
I created a file holding all the md5 values of my files to find duplicates as follows:
find /mnt -type f -print0 | xargs -0 md5sum >> ~/home.md5
...
- 04-15-2010 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 1
md5sum bash script with escaped characters
Hello all,
I created a file holding all the md5 values of my files to find duplicates as follows:
find /mnt -type f -print0 | xargs -0 md5sum >> ~/home.md5
I then tried to find duplicates and do ls -l on the result in such way:
cat ~/home.md5 | awk '{print $1}' | sort | uniq -c | sort -nr | awk '{print $2}' | head -n 10 > ~/top10.md5
Now I attempted to do an ls -l on the files using the command:
for i in `cat ~/top10.md5`;do grep $i ~/home.md5 | while read checksum path; do echo "`echo $(printf '%q' \"${path}\")`" | xargs ls -l; done; done
This works well on most files, however it does not work when filenames have special letters in them that gets escaped such letters with accent etc. These become for examle \303.
Are there any ways I can use the escaped \303 strings with path names, or any better way I can do this?
- 04-17-2010 #2Just Joined!
- Join Date
- Apr 2010
- Posts
- 3
Dan Bernstein's page on this type of issue ...
Since I'm new here, I'm not allowed to post links yet, but, please go to this address: pi cr yp to (put dots between the "pi cr yp to" and paste in address bar).
It might be helpful to you. It seems like much software out there is incorrectly written in regards to non-ASCII and double-byte characters. Maybe with this info you can do some testing to isolate the culprit and replace it or ask the maintainers to fix it ....Last edited by kevlar; 04-17-2010 at 03:01 PM. Reason: mis-spelling.
- 04-18-2010 #3Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
would it work as expected if you modify
byCode:echo $(printf '%q' \"${path}\")Trying in a terminal seems to locate the problem there.Code:echo $(printf \"${path}\")0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.


Reply With Quote