Create Anagrams With Bash On Linux

View previous topic View next topic Go down

Create Anagrams With Bash On Linux

Post by jamied_uk on 7th July 2016, 19:10



Code:
sudo apt-get install -y an



Code:
an -l 8 ballbags





fatphil.org/words/an.html
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Create Anagrams With Bash On Linux

Post by jamied_uk on 7th July 2016, 20:14



Code:
sudo apt-get install -y an


Code:
#/bin/bash
# an -l 8 ballbags
myvar="$@"
size=${#myvar}
#echo $size
#echo $myvar
an -l $size $myvar


Make Executable

Code:
sudo chmod +x anagrams.sh


Usage:

Code:
./anagrams.sh ballbags

Or

Code:
./anagrams.sh "ballbagsn"
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Create Anagrams With Bash On Linux

Post by jamied_uk on 7th July 2016, 20:43

Make words from the letters



Code:
#/bin/bash
# an -l 8 ballbags
myvar="$@"
size=${#myvar}
#echo $size
#echo $myvar
an -l $size -w $myvar

Or

Code:
./anagrams.sh -w "ballbagsn"
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Create Anagrams With Bash On Linux

Post by jamied_uk on 7th July 2016, 20:45

Full usage for the an command


Usage: an [options] PHRASE


Code:
  -c, --contain PHRASE  print anagrams containing PHRASE
  -d, --dict DICTIONARY search DICTIONARY for words
  -l, --length WORDS    find anagrams with up to WORDS number of words
  -m, --minimum WORDLEN only use words at least WORDLEN long
  -n, --number NUM      print a maximum of NUM anagrams
  -w, --words           print words that PHRASE letters make
  -t, --test ANAG       test if ANAG can be made with PHRASE
  -u, --used PHRASE     flag PHRASE letters as already used
  -h, --help            display this help and exit
  -v, --version         output version information and exit
avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Create Anagrams With Bash On Linux

Post by jamied_uk on 21st July 2016, 20:37

Updated Words Version


Code:
#/bin/bash
#Usage ./anagram_words.sh' "SANTA"
myvar="$@"
size=${#myvar}
#echo $size
#echo $myvar
echo $myvar > $myvar.words.txt
an -l $size -w $myvar >> $myvar.words.txt
cat $myvar.words.txt


avatar
jamied_uk
Admin

Posts : 2280
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

Re: Create Anagrams With Bash On Linux

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum