Files
ranlin/man/man1/ranlin.1

58 lines
1.2 KiB
Groff

.Dd July 15, 2025
.Dt ranlin 1
.Os
.Sh NAME
.Nm ranlin
.Nd select one line randomly from a text file
.Sh SYNOPSIS
.Nm
.Fl h
.Nm
.Fl \-version
.Nm
.Op Ar
.Sh DESCRIPTION
The
.Nm
utility randomly chooses a single line from a text file, where the chance a
specific line is chosen is equal for all lines.
When no file arguments are given,
.Nm
will read from the standard input.
When multiple file arguments are given,
.Nm
will output a random line for each file.
.Pp
The options are as follows:
.Bl -tag -width Ds
.It Fl h, \-help
Print help text and exit.
.It Fl \-version
Print version info and exit.
.El
.\" .Sh ENVIRONMENT
.\" For sections 1, 6, 7, and 8 only.
.\" .Sh FILES
.Sh EXIT STATUS
.Nm
exits 0 on success, and 1 if an error occurs.
.\" .Sh EXAMPLES
.\" .Sh DIAGNOSTICS
.\" For sections 1, 4, 6, 7, 8, and 9 printf/stderr messages only.
.\" .Sh SEE ALSO
.\" .Xr foobar 1
.\" .Sh STANDARDS
.Sh HISTORY
The algorithm used by
.Nm
is very clever, and will never have more than two lines in memory, at all times.
It has been taken from
.Dq The Perl Cookbook ,
and implemented in C++ for this tool.
.Sh AUTHORS
.An Bob Polis
.\" .Sh CAVEATS
.\" .Sh BUGS
.\" .Sh SECURITY CONSIDERATIONS
.\" Not used in OpenBSD.