Hi,
How would you do a : find -exec RANDOM?
I was trying something like this:
>> find . -type f |sort -R| find -type f -exec command "{}" \;
And making some tries, I came to this kind of solution.:
find . -type f | sort -R | xargs -I{} find {} -exec command {} \;
It seems to work.. , do you think its ok?
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
How would you: find exec (sorted/random pipe)?
Re: How would you: find exec (sorted/random pipe)?
This two seems to work... good!!, I now know how to make this kind of operation.
find . -type f | sort -R | xargs -I{} find {} -exec command {} \;
find . -type f -print 0| sort -zR | xargs -0 -I{} find {} -exec command {} \;
find . -type f | sort -R | xargs -I{} find {} -exec command {} \;
find . -type f -print 0| sort -zR | xargs -0 -I{} find {} -exec command {} \;
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: How would you: find exec (sorted/random pipe)?
I know you think I'm just being a **** but it really would be best if you explain why you want a randomised order, there might be a better way of acheiving your goal.
deadbang
Re: How would you: find exec (sorted/random pipe)?
I wonder, why would you ask me such a question?Head_on_a_Stick wrote:I know you think I'm just being a **** but it really would be best if you explain why you want a randomised order, there might be a better way of acheiving your goal.
I have hunderths of mp3u files I want to concat them in a randomly way everytime I launch the player, so It can play that huge playlist with a RANDOM new song everytime, and those concat files need a header #EXTINF, for each song to be able to be played, so you just cant concat all files, and then, later sort it randomly, that would also order randomly headers titles #EXTINF.... so, this is the case here, but i do this kind of things very usually...
find . -name "*.m3u" | sort -R | find -exec cat {} > biglist.m3u \;
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: How would you: find exec (sorted/random pipe)?
Try shuf(1) instead of sort(1), it's *much* faster and it does actually randomise the list properly.
deadbang