Difference between revisions of "Talk:Angeldust"

From Free Knowledge Base- The DUCK Project: information for everyone
Jump to: navigation, search
m (Search for a Creature in all Biome flat text data files)
m (Search for a Creature in all Biome flat text data files)
Line 17: Line 17:
 
  <nowiki>#assign path variables</nowiki>
 
  <nowiki>#assign path variables</nowiki>
 
  <nowiki>#The path to your biome data files and your operating system temp directory</nowiki>
 
  <nowiki>#The path to your biome data files and your operating system temp directory</nowiki>
 +
<nowiki>#In the current version, the data files must be in a directory called "biomes"</nowiki>
 
  <nowiki>strBiomeDataFiles="/home/username/Documents/Angeldust/biomes"</nowiki>
 
  <nowiki>strBiomeDataFiles="/home/username/Documents/Angeldust/biomes"</nowiki>
 
  <nowiki>strOSTmpDir="/tmp"</nowiki>
 
  <nowiki>strOSTmpDir="/tmp"</nowiki>

Revision as of 18:38, 22 March 2020

smart blocks

smart block logic

Smartblockfail01.png

Temporary Links

Search for a Creature in all Biome flat text data files

#!/bin/bash
#December 2019 Derek W
#assign path variables
#The path to your biome data files and your operating system temp directory
#In the current version, the data files must be in a directory called "biomes"
strBiomeDataFiles="/home/username/Documents/Angeldust/biomes"
strOSTmpDir="/tmp"

echo "whereis: Biome database search tool v0.10"
declare -i intBiome=0

if [ -z $1 ] ; then
   echo "whereis: too few arguments"
   echo "whereis creature name"
   echo " "
   echo "One or two argunments accepted, such as \"whereis Ocelot \" or  \"whereis Cave Bear \"."
   echo " "
   echo "arguments are not case sensitive. "
   exit 0

else
  if [ -z $3 ] ; then 
    if [ -z $2 ] ; then 
      grep -i $1 ${strBiomeDataFiles}/* > ${strOSTmpDir}/angeldust.biomes.tmp
    else
      grep -i "$1 $2" ${strBiomeDataFiles}/* > ${strOSTmpDir}/angeldust.biomes.tmp
    fi
    intBiome=`wc -l <${strOSTmpDir}/angeldust.biomes.tmp`
    if [ $intBiome -gt 0 ] ; then
      printf "total matching biomes: " 
      echo $intBiome
      awk -i inplace 'BEGIN { FS="biomes/"; } {print $2}' ${strOSTmpDir}/angeldust.biomes.tmp
      echo "----------------------------------------"
      awk 'BEGIN { FS=".txt:"; } {print $2 " is found in " $1}' ${strOSTmpDir}/angeldust.biomes.tmp
    else
      echo "----------------------------------------"
      echo "No match! Try again."
    fi
    echo "----------------------------------------"
  else
    echo "whereis: too many arguments, aborting."
    exit 127;
  fi
fi

rm ${strOSTmpDir}/angeldust.biomes.tmp

exit 0;