Created
June 23, 2024 14:16
-
-
Save bact/b9ccf6bfdfdc30b8947d3d90401f8d34 to your computer and use it in GitHub Desktop.
Generate UUIDv4 with specific prefix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
amount=$1 | |
regex=$2 | |
echo "Generating $amount UUIDs with $regex..." | |
count=0 | |
while [ $count -lt $amount ]; do | |
uuid=$(uuidgen | awk '{print tolower($0)}') | |
if [[ $uuid =~ ^$regex ]]; then | |
echo $uuid | |
((count++)) | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment