#! /bin/bash # Makes a file with a number of key values START=$(date +%s) AMOUNT=1000 BASE=$(dirname $(dirname $(realpath -s $0))); FILE_NAME="pairs.csv" FULL_PATH="$BASE/csv/$FILE_NAME" if [ -f "$FULL_PATH" ]; then rm "$FULL_PATH" fi echo "Generating csv/$FILE_NAME..." KEY_LEN=${#AMOUNT} for (( i = 0; i < "$AMOUNT"; i++ )); do KEY=$(printf "%0${KEY_LEN}d\n" $i) VAL=$(shuf -er -n "$KEY_LEN" {A..Z} | paste -sd "") echo "$KEY,$VAL" >> "$FULL_PATH" done END=$(date +%s) SECONDS=`expr $END - $START` echo "The generation of $AMOUNT pairs took ${SECONDS}s"