Skip to content

Instantly share code, notes, and snippets.

@vallieres
Last active February 7, 2017 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vallieres/7aaaad64f332bc1b701c8f79c2ed6480 to your computer and use it in GitHub Desktop.
Save vallieres/7aaaad64f332bc1b701c8f79c2ed6480 to your computer and use it in GitHub Desktop.
Generate 1000 files with random characters as content of the length of the index
#!/bin/bash
# Generates 1000 files with name from 1.txt to 1000.txt, each file has a random set of letters and number equivalent to the number its filename.
# For example, 12.txt has a string of 12 chars inside it.
for i in {0001..1000}
do
CONTENT=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w $i | head -n 1)
echo $CONTENT > "file_${i}.txt"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment