[opensuse] recursive md5 files order
Hello: I am using the following syntax to create an md5 file containing all the md5 sums recursively:
find . -type f -print0 | xargs -0 md5sum > ~/tmp/foo.md5
Unfortunately this method crates an md5 file in which the order of the files seems to be random. Eg: 4e0a0c9d1c2d94cf8481a3e32f95b55b ./Album1/07.mp3 442765056a35156e9d6d19ccde5a0801 ./Album1/11.mp3 8c794bbfdad7e00860739d1852c3db86 ./Album1/09.mp3 489ffb1566b1bd1f21625c6f9fcf19d8 ./Album1/06.mp3 477baacaf7e95ea483d9ed1d94bed0bb ./Album1/10.mp3 etc. How could I get the files and subdirectories sorted in alphabetical order? TIA, IG ______________________________________________________________________ Akciós utazást mindenkinek! Last minute ajánlatok akár 50%-os kedvezménnyel. www.budavartours.hu -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Sat, 23 Aug 2008, Istvan Gabor wrote:
I am using the following syntax to create an md5 file containing all the md5 sums recursively:
find . -type f -print0 | xargs -0 md5sum > ~/tmp/foo.md5
Unfortunately this method crates an md5 file in which the order of the files seems to be random. Eg: [..] How could I get the files and subdirectories sorted in alphabetical order?
find . -type f -print0 | sort -z | xargs -0 md5sum > ~/tmp/foo.md5 HTH, -dnh -- Never put off till tomorrow what you can avoid all together. -- fortune file -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
I am using the following syntax to create an md5 file containing all the md5 sums recursively:
find . -type f -print0 | xargs -0 md5sum > ~/tmp/ foo.md5
Unfortunately this method crates an md5 file in which the order of the files seems to be random. Eg: [..] How could I get the files and subdirectories sorted in alphabetical order?
find . -type f -print0 | sort -z | xargs -0 md5sum > ~/ tmp/foo.md5
Thank you, sort -z did the trick. I have tried sort too but without the -z option. I never would have found out that this option is required. Thanks. IG ______________________________________________________________________ Digitális fényképezőgépek akár 5000 Ft ajándék fotókidolgozással a FotoMarket Online Fotóáruházban! - www.fotomarket.hu VÁSÁROLNA? SEGÍTÜNK! Igényeljen hitelkártyát online és élvezze Ön is a vásárlás szabadságát! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hello, On Sat, 23 Aug 2008, Istvan Gabor wrote: [..]
find . -type f -print0 | sort -z | xargs -0 md5sum > ~/ tmp/foo.md5
Thank you, sort -z did the trick. I have tried sort too but without the -z option. I never would have found out that this option is required.
You don't have lines there, but names seperated by ASCII 0 [1], as requested by using '-print0' with find. sort usually sorts lines (seperated by ASCII 10 [2]) ... from man ascii: Oct Dec Hex Char -------------------------- [1] 000 0 00 NUL '\0' [2] 012 10 0A LF '\n' HTH, -dnh -- Top 100 things you don't want the sysadmin to say: 51. YEEEHA!!! What a CRASH!!! -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Istvan Gabor schreef:
Hello:
I am using the following syntax to create an md5 file containing all the md5 sums recursively:
find . -type f -print0 | xargs -0 md5sum > ~/tmp/foo.md5
Unfortunately this method crates an md5 file in which the order of the files seems to be random. Eg:
4e0a0c9d1c2d94cf8481a3e32f95b55b ./Album1/07.mp3 442765056a35156e9d6d19ccde5a0801 ./Album1/11.mp3 8c794bbfdad7e00860739d1852c3db86 ./Album1/09.mp3 489ffb1566b1bd1f21625c6f9fcf19d8 ./Album1/06.mp3 477baacaf7e95ea483d9ed1d94bed0bb ./Album1/10.mp3
etc.
How could I get the files and subdirectories sorted in alphabetical order?
erm... sort? :-) You have two fields separated by whitespace, so don't have to do anything fancy, just specify that the key is the second field: sort --key=2 ~/tmp/foo.md5 > ~/tmp/bar.md5 Regards, -- Jos van Kan registered Linux user #152704 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (3)
-
David Haller
-
Istvan Gabor
-
Jos van Kan