daily pastebin goal
24%
SHARE
TWEET

ScriptSerializacion.sh

a guest Sep 22nd, 2016 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/bash
  2.  
  3. user="root"
  4. pass="alexander"
  5. bd="sakila"
  6. salida="/root/Downloads/serializado"
  7. extension="csv"
  8.  
  9. if [ ! -d $salida ]; then
  10.         mkdir -p $salida
  11. fi
  12.  
  13. for tabla in $(mysql -u$user -p$pass $bd -Be "show tables" | sed 1d )
  14. do
  15.         mysql -u$user -p$pass  $bd -e "select * from $tabla" | sed 's/\t/,/g'> $salida/$tabla.$extension
  16.  
  17. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top