From owner-freebsd-questions Sat Nov 25 19:17:12 2000 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 8DEBF37B4CF for ; Sat, 25 Nov 2000 19:17:10 -0800 (PST) Received: (from dan@localhost) by dan.emsphone.com (8.11.1/8.11.1) id eAQ3GpH23317; Sat, 25 Nov 2000 21:16:51 -0600 (CST) (envelope-from dan) Date: Sat, 25 Nov 2000 21:16:51 -0600 From: Dan Nelson To: cjclark@alum.mit.edu Cc: Sue Blake , freebsd-questions@FreeBSD.ORG Subject: Re: unsorting Message-ID: <20001125211651.B6923@dan.emsphone.com> References: <20001126023150.F377@welearn.com.au> <20001125143838.Z12190@149.211.6.64.reflexcom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.11i In-Reply-To: <20001125143838.Z12190@149.211.6.64.reflexcom.com>; from "Crist J . Clark" on Sat Nov 25 14:38:38 GMT 2000 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (Nov 25), Crist J . Clark said: > On Sun, Nov 26, 2000 at 02:31:53AM +1100, Sue Blake wrote: > > Is there some fairly simple way I can put a list of letters or > > words, or lines of a text file, into a random order? > > However, a really quick and ugly approach is to load the list into > memory, then just step through it swapping each item with another in > a random location. To be a little different, here is an awk(1) script > that does it, And just to be a bit more different, here's a shell script that will randomize the contents of the filename passed on the commandline: #! /bin/sh jot -r $(wc -l < $1) 1 1000000 | paste - $1 | sort -n | cut -f2- -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message