Xml

如何使用 shell 腳本在 xml 文件中附加 xml 數據?

  • March 22, 2011

script.sh

#!/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 文件中獲取這些數據?

#!/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

引用自:https://serverfault.com/questions/250314