sql >> Base de Datos >  >> RDS >> Mysql

¿Cómo elimino una tabla de un mysqldump?

Podrías usar 'n,n d' para eliminar ciertas líneas. Supongo que en tu caso quieres tener la tabla en cuestión, pero no quieres los datos.

Cambie el comando grep para incluir "Dumping data for table":

grep -n 'Table structure\|Dumping data for table' dump.sql 
19:-- Table structure for table `t1`
37:-- Dumping data for table `t1`
47:-- Table structure for table `t2`
66:-- Dumping data for table `t2`
76:-- Table structure for table `t3`
96:-- Dumping data for table `t3`

Ahora, si no desea los datos para t2, podría usar:

sed '66,75 d' dump.sql > cleandump.sql