mix(1) – randomly sort inputs #55

Open
opened 2024-02-11 12:38:29 -07:00 by emma · 5 comments
Owner
No description provided.
emma added the
enhancement
label 2024-02-11 12:38:29 -07:00
Author
Owner

From shuf(1):

DESCRIPTION
       Write a random permutation of the input lines to standard output.

       With no FILE, or when FILE is -, read standard input.

       Mandatory arguments to long options are mandatory for short options
       too.

       -e, --echo
              treat each ARG as an input line

       -i, --input-range=LO-HI
              treat each number LO through HI as an input line

       -n, --head-count=COUNT
              output at most COUNT lines

       -o, --output=FILE
              write result to FILE instead of standard output

       --random-source=FILE
              get random bytes from FILE

       -r, --repeat
              output lines can be repeated

       -z, --zero-terminated
              line delimiter is NUL, not newline

       --help display this help and exit

       --version
              output version information and exit

I think this should work like rpn(1) and take standard input if there are no arguments, so no need for -e. No need of course for --version and --help. I don’t think -r or -n belong here. I’m not sure about having analogues --random-source and -i.

From `shuf(1)`: ``` DESCRIPTION Write a random permutation of the input lines to standard output. With no FILE, or when FILE is -, read standard input. Mandatory arguments to long options are mandatory for short options too. -e, --echo treat each ARG as an input line -i, --input-range=LO-HI treat each number LO through HI as an input line -n, --head-count=COUNT output at most COUNT lines -o, --output=FILE write result to FILE instead of standard output --random-source=FILE get random bytes from FILE -r, --repeat output lines can be repeated -z, --zero-terminated line delimiter is NUL, not newline --help display this help and exit --version output version information and exit ``` I think this should work like `rpn(1)` and take standard input if there are no arguments, so no need for `-e`. No need of course for `--version` and `--help`. I don’t think `-r` or `-n` belong here. I’m not sure about having analogues `--random-source` and `-i`.
Author
Owner

And -o is redundant with redirection.

And `-o` is redundant with redirection.
Owner

Maybe shuffle?

Then you could do stuff like for f in /media/audio/*; do scrut -f "$f" && out "$f"; done | shuffle | xargs mpv.

I agree with -e being unnecessary and file arguments not being taken (just mm -i f -i f2 | shuffle), no -i (use sed) or -n (use sed) or -o (| mm -o). -z seems useful to me but with -0, though its use here makes me think ASV would be a better fit. I'm gonna talk about --random-source in #8.

-r seems useful to me but necessitates -n to make sure it doesn't repeat forever. Maybe we should have a repeat(1) command to take standard input and spit it out repeated n times.

Maybe `shuffle`? Then you could do stuff like `for f in /media/audio/*; do scrut -f "$f" && out "$f"; done | shuffle | xargs mpv`. I agree with `-e` being unnecessary and file arguments not being taken (just `mm -i f -i f2 | shuffle`), no `-i` (use `sed`) or `-n` (use `sed`) or `-o` (`| mm -o`). `-z` seems useful to me but with `-0`, though its use here makes me think ASV would be a better fit. I'm gonna talk about `--random-source` in #8. `-r` seems useful to me but necessitates `-n` to make sure it doesn't repeat forever. Maybe we should have a repeat(1) command to take standard input and spit it out repeated *n* times.
Author
Owner

How is mix(1) for a name?

How is `mix(1)` for a name?
Owner

How is mix(1) for a name?

I like it.

> How is `mix(1)` for a name? I like it.
emma changed title from GNU `shuf(1)` analogue to `mix(1)` – randomly sort inputs 2024-04-26 21:20:48 -06:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: bonsai/harakit#55
No description provided.