Skip to content

jakekara/pyshuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyshuff

An inexact clone of GNU shuf. Free, implemented in Python.

Install

Usage

Same as shuf, but the script is invoked with pyshuf. Read the GNU manual for shuf for more details. I haven't used shuf -- I wrote this because it didn't come standard on MacOS.

"Cookbook"

Generate a random number from 0 to 99

 $ pyshuf -i 0-99 -n 1
 73

Pick a random word from the dictionary (dictionary location may vary)

 $ pyshuf --input-file /usr/share/dict/words -n 1
 irreflectiveness

Shuffle the first 10 words from the dictionary

 $ head /usr/share/dict/words | pyshuf
 aardvark
 aalii
 Aaron
 a
 aa
 Aani
 aam
 aardwolf
 A
 aal

Use input from the command line

 pyshuf: error: argument -e/--echo: ignored explicit argument 'cho'
 $ pyshuf --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

About

An inexact python clone of GNU shuf.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages