An attempt to bugfix an inexact python clone of GNU shuf and bring it into the modern Python 3 era.
Project description
pyshuf2
An inexact clone of GNU shuf. Free, implemented in Python.
Install
pyshuf2 can be installed via pip:
pip install pyshuf2
If you are installing the development version, just clone the repo & run this inside the cloned directory:
pip install -e .
This will also allow you to edit the program and then re-run it without reinstalling.
Usage
Same as shuf, but the script is invoked with pyshuf2. Read the GNU manual for shuf for more details.
"Cookbook"
Generate a random number from 0 to 99
$ pyshuf2 -i 0-99 -n 1
73
Pick a random word from the dictionary (dictionary location may vary)
$ pyshuf2 --input-file /usr/share/dict/words -n 1
irreflectiveness
Shuffle the first 10 words from the dictionary
$ head /usr/share/dict/words | pyshuf2
aardvark
aalii
Aaron
a
aa
Aani
aam
aardwolf
A
aal
Use input from the command line
pyshuf2: error: argument -e/--echo: ignored explicit argument 'cho'
$ pyshuf2 --echo one two three four five
four
two
three
one
five
Features implemented
--e, --echo
-i, --input-range
-n, --head-count
-o, --output-file
Features not implemented
--random-source
-r, --repeat
-z, --zero-terminated
Features added that are not present in GNU shuf
--input-file specify an input file to read from
This is a Fork
Please note that this is a fork of jakekara/pyshuf.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyshuf2-2.1.0.tar.gz.
File metadata
- Download URL: pyshuf2-2.1.0.tar.gz
- Upload date:
- Size: 15.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f691a63cffbdd7cbd191fb699441765344955a1e50f0ff32afb6964650c3f6f
|
|
| MD5 |
78a949c6d710652c0d5d1fd04b06464f
|
|
| BLAKE2b-256 |
eb312f77c15fe1ab36cfa6d30907a661d0b50b40aca49a6d3517abf0936d53f2
|
File details
Details for the file pyshuf2-2.1.0-py3-none-any.whl.
File metadata
- Download URL: pyshuf2-2.1.0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6ce708442ca87153e708d4d631b47e1bd83ca57acb4a334664340aef63f0fd4
|
|
| MD5 |
875ab8ea57bdbb14a1c7955c5a185a52
|
|
| BLAKE2b-256 |
fc8372ca78569efc8a19d5fef5f81fc2e33d4d695b9ab727a98d754c481f9e34
|