bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new coreutil? shuffle - randomize file contents


From: Bob Proulx
Subject: Re: new coreutil? shuffle - randomize file contents
Date: Tue, 24 May 2005 10:35:04 -0600
User-agent: Mutt/1.5.9i

Lemley James - jlemle wrote:
> Certainly I don't expect everyone to be a programmer in order to be able
> to shuffle their playlist, but perhaps an example needs to be added to
> the sort man-page stating how easy is to accomplish with tools that are
> likely already installed on your system (specifically, "awk" to add a
> pseudorandom key to a line and "cut" to remove it): 
> 
> find /music -name '*ogg' -type f | 
> awk 'BEGIN{srand()}{printf "%06d%s\n", rand()*1000000, $0}' | 
> sort | 
> cut -b 7- > /music/randomized_oggfiles.m3u

Your solution and a previously posted one are quite similar.

  http://lists.gnu.org/archive/html/bug-coreutils/2005-01/msg00148.html

Yours has the advantage of not using $RANDOM, a ksh/bash specific
feature not in POSIX.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]