如何使用 shell 脚本将 xml 数据附加到 xml 文件内?

如何使用 shell 脚本将 xml 数据附加到 xml 文件内?

脚本

#!/bin/sh
mysql -u root -pmysql --xml << eof
SELECT TABLE_NAME AS "Table Name", table_rows AS "Quant of Rows", ROUND((data_length + index_length)/1024/1024,2) AS "Total Size Mb"  FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema='database_name';
eof

我正在使用上述脚本获取 xml 数据。如何在 xml 文件中获取这些数据?

答案1

#!/bin/sh
mysql -u root -pmysql --xml > /home/test/Desktop/temp.xml << eof
SELECT TABLE_NAME AS "Table Name", table_rows AS "Quant of Rows", ROUND((data_length + index_length)/1024/1024,2) AS "Total Size Mb"  FROM information_schema.TABLES WHERE information_schema.TABLES.table_schema='database_name';
eof

相关内容