bug-coreutils
[Top][All Lists]
Advanced

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

Re: [PATCH] Makes sort create random order


From: Bob Proulx
Subject: Re: [PATCH] Makes sort create random order
Date: Thu, 27 Jan 2005 22:21:38 -0700
User-agent: Mutt/1.5.6+20040907i

Frederik Eaton wrote:
> This is in response to a mail I found in the archive from "Wed, 25 Aug
> 2004 16:14:15 +0200" that adds an -R option to sort randomly. I've
> been seeking to add such functionality to sort for a while.

This is not really what you are asking for.  But when I need this
functionality I do it in the shell.  Here is an example.  I am not
particular about the exact type of non-ordered output.

  seq 1 20 > /tmp/datafile

  for i in $(<datafile); do echo $RANDOM $i; done \
    | sort -n | sed 's/^[0-9][0-9]* //'

A friend introduced me to that trick a few years ago and I have been
using it ever since.  $RANDOM is a ksh/bash specific feature.  It is
not POSIX but is widely available.

> 3. Is there a way to subscribe to this mailing list?

You can do it with a single line cut and paste command.

  echo subscribe | mailx -s request address@hidden

The -request part is a very important part of that command.

Bob




reply via email to

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