command line - Making a large file using the terminal - Ask Ubuntu


i want make file large in size testing purposes should contains unique words (strictly not repeated). can in gb, tb, etc. may terminal?

i using ubuntu 16.04 (xenial xerus).

creating infinite number of words, guaranteed unique

the script below generate guaranteed unique words characters alphabet. issue fixed length of characters produce limited set of possibilities, limiting size of file.

i therefore used python's permutations, produces (finite) number of unique words. however after using combinations, start over, printing words 2, 3, four, n times etc., every value n create new unique word. have generator produce 100% unique words.

the script:

import itertools import string  ab = [c c in string.ascii_lowercase]  t = 1 while true:        n in range(1, len(ab)+1):          words = itertools.permutations(ab, n)         word in words:             print(t*("".join(word)))     t += 1 

how use

  • simply copy script empty file, save unique_generator.py
  • run command:

    python3 /path/to/unique_generator.py > /path/to/bigfile.txt 

note

the script produces unique words of various lenght. if want, start- or max length can set, changing lines:

for n in range(1, len(ab)+1) 

(replace start of range), , changing:

while true:   

into (for example):

while t < 10:    

in last case, length of words max 10 times alphabet.

ending process

  • when running terminal, press ctrl+c
  • otherwise:

    kill $(pgrep -f /path/to/unique_generator.py) 

    should job.


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User