From 20e570822878c6ca0e6220dd9e6a44273f8fa280 Mon Sep 17 00:00:00 2001 From: cnphpbb Date: Wed, 24 Sep 2025 18:39:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(shell):=20=E6=B7=BB=E5=8A=A0MySQL=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=86=E5=89=B2=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增mysqlSQLSplinter.sh脚本,用于从SQL转储文件中提取指定表的数据 --- shell/mysqlSQLSplinter.sh | 51 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 shell/mysqlSQLSplinter.sh diff --git a/shell/mysqlSQLSplinter.sh b/shell/mysqlSQLSplinter.sh new file mode 100644 index 0000000..bcc45f6 --- /dev/null +++ b/shell/mysqlSQLSplinter.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +tableName=$1 +inputdt=$2 +if [ -z "$tableName" ]; then + echo "请输入表名" + exit 1 +fi + +if [ -z "$inputdt" ]; then + echo "请输入日期" + exit 1 +fi + +cat > ./${tableName}-${inputdt}-out.sql <> ${tableName}-${inputdt}-out.sql + +sed -n "/^-- Dumping data for table \`${tableName}\`/,/^-- Dumping data for table \`/p" ./${tableName}-${inputdt}.sql | sed '$d' >> ${tableName}-${inputdt}-out.sql + +cat >> ./${tableName}-${inputdt}-out.sql <