[opensuse] Re: fake random sort
Le 27/11/2009 16:55, Jan Ritzerfeld a écrit :
for i in *.jpg; do echo mv -i $i $(echo ${i%.jpg} | md5sum | cut -c 1-5).jpg; done
looks goos but gives me a cut error. is it possible to do the same with $RANDOM? thanks jdd -- http://www.dodin.net http://valerie.dodin.org http://news.opensuse.org/2009/04/13/people-of-opensuse-jean-daniel-dodin/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Am Freitag, 27. November 2009 schrieb jdd-gmane:
Le 27/11/2009 16:55, Jan Ritzerfeld a écrit :
for i in *.jpg; do echo mv -i $i $(echo ${i%.jpg} | md5sum | cut -c 1-5).jpg; done
looks goos but gives me a cut error.
"cut -c 1-5", perhaps the space at the line break was lost somewhere. ^
is it possible to do the same with $RANDOM?
This might work: for i in *.jpg; do echo mv -i $i ${RANDOM::5}.jpg; done Here a version with line breaks at reasonable positions that you can paste into a file and make it executable: #!/bin/bash for i in *.jpg; do echo mv -i $i $(echo ${i%.jpg} | md5sum | cut -c 1-5).jpg; done Gruß Jan -- There is no such thing as a "free lunch". (only a choice of restaurants) -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (2)
-
Jan Ritzerfeld
-
jdd-gmane