rl is a command-line tool that reads lines from an input file or stdin, randomizes the lines and outputs a specified number of lines. It does this with only a single pass over the input while trying to use as little memory as possible.
I wrote rl in my spare time mainly to be able to select a random audio file to play when my toast is done (script in combination with find and sleep). Another reason was to familiarize myself with autoconf and friends.
The most recent version of this page can be found at https://arthurdejong.org/rl/.
Warning: rl is software in development. The command line options and default behavior may change between releases.
Another Warning: I have mostly lost interest in this project and am not planning on doing much development on it any more. I will however still accept patches and fix important bugs (this more or less contradicts the previous warning).
Note: Users are recommended to use shuf from GNU coreutils instead which has been included since coreutils 6.0.
At the moment rl is source-only. You can also get rl from Debian by doing:
% apt-get install randomize-lines
Or you can download one of the files below and follow the installation instructions below.
Copyright © 2001-2008 Arthur de Jong
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the GNU General Public License for more details.
A copy of the GNU General Public License is available in the download and can be found on the World Wide Web at http://www.gnu.org/copyleft/gpl.html. You can also obtain it by writing to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
rl should compile fine on most Unix-like operating systems. It is written to be as portable as possible.
rl uses a configure script to guess build parameters for your system. Configuration, compilation and installation would be as simple as one, two, three:
% ./configure % make % make install
For more details read the included README and INSTALL files.
The randomize lines development repository is available
through svn (read-only) with
The repository is also browsable through viewcvs at https://arthurdejong.org/viewvc/rl/
Please note that the development version should work in general (although an ocasional bug shows up once in a whil) but the released versions are more thoroughly tested.
Also note that the address of the repository could change in the future.
rl is still in development and there are more features to implement. The development is currently based on the "it works for me" principle. Things to do:
If you want any features added to rl or you have comments or questions you can email me at email@example.com. Patches for bug fixes and feature extensions are appreciated.
sleep 240 ; play `find /sounds -name '*.au' -print | rl --count=1`
renice +5 -u `who | cut '-d ' -f 1 | sort -u | rl --count=1`
kill -9 `ps -A | cut '-d ' -f 2 | rl --count=1`