Skip to main content

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

Usage

Same as shuf, but the script is invoked with pyshuf2. Read the GNU manual for shuf for more details. I created this fork because I needed it on an embedded system that ran an extremely limited copy of Linux, on 128 MB of RAM, and had only 16 GB of storage.

"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 I implemented

--e, --echo
-i, --input-range
-n, --head-count

Features I have not implemented

-o, --output-file
--random-source
-r, --repeat
-z, --zero-terminated

Features I added that are not 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyshuf2-2.0.0.post1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyshuf2-2.0.0.post1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file pyshuf2-2.0.0.post1.tar.gz.

File metadata

  • Download URL: pyshuf2-2.0.0.post1.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pyshuf2-2.0.0.post1.tar.gz
Algorithm Hash digest
SHA256 f56f4ea9e539d75e3b812c6b84cc5ac3972f8a0f619a2dd8d81e9dc8cb329eaf
MD5 5083f3752f04e37e2c2e1c793f75bbf5
BLAKE2b-256 8d578aa26dacde0b8a358e080548a38680873ccadfaffe2c7f0a27478f013592

See more details on using hashes here.

File details

Details for the file pyshuf2-2.0.0.post1-py3-none-any.whl.

File metadata

  • Download URL: pyshuf2-2.0.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for pyshuf2-2.0.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 720af1dabad721ece5e41169f35bac62a1af36886e44d96b4d59baf0e9a01da0
MD5 ca8f16d79d080e1e6b92a4fdb9a1fa23
BLAKE2b-256 34a80c650aea08584d8f650f1c5a90dce0cc42f6e8f941901fdf143a03ce3422

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page