summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2017-12-05 15:40:31 +0100
committerPatrick Simianer <p@simianer.de>2017-12-05 15:40:31 +0100
commit48fc2e94f023deb0783befdf970a5ae81e585e48 (patch)
treef6efd23c50dd00a025f9b24d0af9b7c63fa1216b
parente58af8b555da48c267593fbfefa0a83f663c5908 (diff)
bishuf: simplistic synchronized shuffing of two files
-rwxr-xr-xbishuf17
1 files changed, 17 insertions, 0 deletions
diff --git a/bishuf b/bishuf
new file mode 100755
index 0000000..e3560f6
--- /dev/null
+++ b/bishuf
@@ -0,0 +1,17 @@
+#!/usr/bin/env zsh
+
+SHUF=$(which shuf)
+if [[ $? -ne 0 ]]; then
+ SHUF=$(which gshuf)
+ if [[ $? -ne 0 ]]; then
+ echo "no `shuf` found, exiting"
+ exit
+ fi
+fi
+
+F=$(mktemp /tmp/bishuf.XXXXXX)
+echo 42 > $F
+$SHUF --random-source=$F $1 > $1.shuf
+$SHUF --random-source=$F $2 > $2.shuf
+rm $F
+