Skip to content

Instantly share code, notes, and snippets.

@jonasabreu
Created February 25, 2013 14:39
Show Gist options
  • Save jonasabreu/5030203 to your computer and use it in GitHub Desktop.
Save jonasabreu/5030203 to your computer and use it in GitHub Desktop.
Geração de tabelas para os dados do datasus
#! /bin/bash
TABELAS=`find . -path ./TABELAS_SUS -prune -o -iname *.dbf | cut -d "/" -f 4 | sed -r 's/([a-zA-Z]+)[a-zA-Z]{2}.*/\1/' | tr '[A-Z]' '[a-z]' | sort | uniq`
for X in $TABELAS; do
ARQUIVO=`find . -path ./TABELAS_SUS -prune -o -iname "$X*.dbf" | grep -i dbf | tail -n 1`
echo "gerando tabela $X usando $ARQUIVO"
dbf2mysql -d datasus -t $X -cc -U root $ARQUIVO
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment