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)?

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

How would you: find exec (sorted/random pipe)?

#1 Post by bester69 »

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.. :shock: , do you think its ok?
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How would you: find exec (sorted/random pipe)?

#2 Post by bester69 »

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 {} \;


:o
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
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)?

#3 Post by Head_on_a_Stick »

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

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: How would you: find exec (sorted/random pipe)?

#4 Post by bester69 »

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 wonder, why would you ask me such a question? :shock:

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...

User avatar
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)?

#5 Post by Head_on_a_Stick »

Try shuf(1) instead of sort(1), it's *much* faster and it does actually randomise the list properly.
deadbang

Post Reply