Index | Thread | Search

From:
Pontus Stenetorp <pontus@stenetorp.se>
Subject:
Re: NEW: sysutils/shuf
To:
"Thomas L." <tom.longshine@web.de>, izder456 <izder456@disroot.org>
Cc:
ports@openbsd.org
Date:
Wed, 15 May 2024 14:47:25 +0900

Download raw body.

Thread
On Tue 14 May 2024, Thomas L. wrote:
>
> On Wed, 8 May 2024 23:14:28 -0500 izder456 <izder456@disroot.org> wrote:
> >
> > I found it as a nice little utility for those who use GNU's shuf, but
> > don't want to use GNU stuff cos of licensing or lack of shuf in
> > userland.
> 
> there is also `sort -R`.

Just note that unlike GNU's shuf(1), `sort -R` (both OpenBSD's and GNU's) will group equal keys [1]. This can lead to unexpected behaviour if you say want to sample N keys and you expect identical behaviour to shuf(1). Personally, I have a short awk(1) script in ~/bin to replicate shuf(1).

[1]: https://man.openbsd.org/sort#R