Is there a standard Unix tool to create permutations?

12 views
Skip to first unread message

Janis Papanagnou

unread,
Mar 22, 2022, 12:49:03 PMMar 22
to
Is there a standard Unix tool to create permutations?

I am using 'shuf' to create permutations of data, and in
GNU context I can also use 'sort -R' for that, it seems.
But inspecting the utilities section of the POSIX specs I
haven't found any tool for that purpose. - Is there any?

Note: I can of course use awk and program my own function,
but I was looking for a - similar to 'shuf' - ready to use
standard tool.

Janis

Ed Morton

unread,
Mar 22, 2022, 1:37:22 PMMar 22
to
I've seen so many Q&A online about permutations over the years with
no-one ever suggesting a Unix tool that does it that I think I can
safely say "no".

Ed.

Lew Pitcher

unread,
Mar 22, 2022, 2:21:36 PMMar 22
to
Don't know if this fits your use-case, but the ptx(1) command
permutes it's inputs. ptx(1) builds a permuted index of a
file's contents, and is used to create the "permuted index"
index page in unix (paper) manuals.

Perhaps the permutations that ptx(1) builds will suffice for
your use-case

HTH
--
Lew Pitcher
"In Skills, We Trust"

Janis Papanagnou

unread,
Mar 23, 2022, 10:46:26 AMMar 23
to
On first glance it seems to be as usable as shuf is. Though I
cannot find this tool as standard tool of the POSIX utilities
as well. - As indicated, I can already solve the task. I was
just looking whether there's a standard tool I could use just
in case that I had to work in a standard environment. Thanks.

Janis

>
> HTH
>

Reply all
Reply to author
Forward
0 new messages