Skip to content

Instantly share code, notes, and snippets.

@chrdek
Last active February 11, 2023 15:41
Show Gist options
  • Save chrdek/5212b64dec4901e5f8290d91323f0328 to your computer and use it in GitHub Desktop.
Save chrdek/5212b64dec4901e5f8290d91323f0328 to your computer and use it in GitHub Desktop.
Methods of generating random data for mysql imports
#!/bin/bash
echo "UserName,Email,FirstName,LastName,Password" > users.csv;
for i in $(seq 1 100);
do
userid=$(uuidgen | sed 's/-//g');
uniqueid=$(echo $userid | head -c 10);
echo "$uniqueid,[email protected],FirstName,LastName,$( head -100 /dev/urandom | tr -dc a-zA-Z0-9 | fold -w ${1:-15} | head -1 )" >> users.csv
done
#!/bin/bash
echo "UserName,Email,FirstName,LastName,Password" > users.csv;
for i in $(seq 1 100);
do
echo "$(uuidgen | sed 's/-//g'),$(uuidgen | sed 's/-//g')@temporary.net,FirstName,LastName,$( head -100 /dev/urandom | tr -dc a-zA-Z0-9 | fold -w ${1:-15} | head -1 )" >> users.csv
done
#!/bin/bash
echo "UserName,Email,FirstName,LastName,Password" > users2.csv;
for i in $(seq 1 100);
do
echo "$(uuidgen | sed 's/-//g'),$(uuidgen | sed 's/-//g')@temporary.net,FirstName,LastName,$(head -c 10 /dev/random | base64 | head -c 10)" >> users2.csv
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment