bash - generate text file from set of character -


i want generate 1 text file containing combinations possible restricted character set bash , or may python

for example have

aabbc01+ 

and want have combinations 9 , 10 character long start with

aaaaaaaaa 

finish with

++++++++++ 

passing through

+++++++++ aaaaaaaaaa 

already discussed in forum

for python:

python -c "from itertools import permutations p ; print('\n'.join([''.join(item) line in open('file') item in p(line[:-1])]))" 

where file contains input string

for bash -- slower

perm() {   items="$1"   out="$2"   [[ "$items" == "" ]] && echo "$out" && return   (( i=0; i<${#items}; i++ )) ;     ( perm "${items:0:i}${items:i+1}" "$out${items:i:1}" )     done   } while read line ; perm $line ; done < file 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -