PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Create Anagrams With Bash On Linux

Go down

Create Anagrams With Bash On Linux Empty Create Anagrams With Bash On Linux

Post by jamied_uk 7th July 2016, 19:10



Code:
sudo apt-get install -y an



Code:
an -l 8 ballbags





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

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Create Anagrams With Bash On Linux Empty Re: Create Anagrams With Bash On Linux

Post by jamied_uk 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"
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Create Anagrams With Bash On Linux Empty Re: Create Anagrams With Bash On Linux

Post by jamied_uk 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"
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Create Anagrams With Bash On Linux Empty Re: Create Anagrams With Bash On Linux

Post by jamied_uk 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
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Create Anagrams With Bash On Linux Empty Re: Create Anagrams With Bash On Linux

Post by jamied_uk 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


jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Create Anagrams With Bash On Linux Empty Re: Create Anagrams With Bash On Linux

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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