You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1016 B

  1. #!/bin/bash
  2. #
  3. # EndNote - Importer to RefBase MySQL table
  4. #
  5. # Andreas Czerniak <ac@oceanlibrary.org>
  6. #
  7. # initial: 05-11-2005
  8. #
  9. # modified:
  10. # 2005-12-11 ; ac ; clean up static codes
  11. # 2005-12-15 ; rk ; remove "v.9", import into CVS
  12. # 2006-01-03 ; ac ; replace LOAD DATA INTO statement with mysqlimport - Thx. Matthias Steffens <refbase@extracts.de>
  13. #
  14. if [ $# -lt 1 ]; then
  15. echo "Which endnote file ?"
  16. echo -e "\nusage: $0 endnote.file [database [mysql-options] ]\n"
  17. exit 127
  18. fi
  19. ENFILE=$1
  20. MYSQLDB=$2 || MYSQLDB="literature" # default: literature
  21. MYSQLOPTION=$3 || MYSQLOPTION="-p" # default: with password
  22. if [ ! -d imported ] ; then
  23. mkdir imported
  24. fi
  25. ./endnote2mysql.php $1
  26. if [ ! -f import.txt ] ; then
  27. echo "endnote2mysql convert failed !"
  28. exit 0
  29. fi
  30. mv import.txt refs.txt
  31. mysqlimport --local $MYSQLOPTION $MYSQLDB "refs.txt" > sqloutput.txt
  32. cat sqloutput.txt
  33. rm refs.txt
  34. rm sqloutput.txt
  35. cat $ENFILE | tail
  36. echo "\n\nrows imported: "
  37. cat $ENFILE | wc -l
  38. mv $ENFILE imported/.