Advertisement
Kylroi

2nd - Spell # lookup - bash

Sep 1st, 2015
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.50 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Second release supports commas in in the spell name
  4.  
  5. #adjust for path where Spell.dbc has been converted to a csv file
  6. SPELLCSV=~/path_to/Spell.dbc.csv
  7.  
  8. if [ $# -ne 1 ]
  9. then
  10.   echo
  11.   echo "Usage:"
  12.   echo "  `basename $0` <spell number>"
  13.   echo
  14.   exit
  15. fi
  16.  
  17. SPELL=$1
  18.  
  19. GREPLN=`grep -e "^$SPELL," "$SPELLCSV"`
  20.  
  21. if [ "$GREPLN" ]
  22. then
  23.   echo $GREPLN | awk -F"," 'BEGIN { FPAT = "([^,]+)|(\"[^\"]+\")" } { print "Spell #" $1 " = " $22 }'
  24. else
  25.   echo "Spell #$SPELL not found."
  26. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement