Difference between revisions of "Talk:Angeldust"
From Free Knowledge Base- The DUCK Project: information for everyone
(→Search for a Creature in all Biome flat text data files: new section) |
m (→Search for a Creature in all Biome flat text data files) |
||
Line 13: | Line 13: | ||
== Search for a Creature in all Biome flat text data files == | == Search for a Creature in all Biome flat text data files == | ||
− | <nowiki>#!/bin/bash</nowiki> | + | <nowiki>#!/bin/bash</nowiki> |
<nowiki>#December 2019 Derek W</nowiki> | <nowiki>#December 2019 Derek W</nowiki> | ||
<nowiki>#assign path variables</nowiki> | <nowiki>#assign path variables</nowiki> |
Revision as of 14:19, 22 March 2020
smart blocks
smart block logic
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 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;