You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
989 B
33 lines
989 B
# 定义目标表名
|
|
import time
|
|
|
|
target_tables = [
|
|
"spider_latest_journal_paper_list",
|
|
"spider_latest_qikan_column_list",
|
|
"spider_latest_qikan_list"
|
|
]
|
|
|
|
# 输出文件保存路径
|
|
output_file = "found_tables.sql"
|
|
|
|
# 初始化变量
|
|
found_lines = []
|
|
|
|
|
|
# 逐行读取文件
|
|
with open("/home/majiahui/project/mysql_file_zw_paper/fabiao.sql", "r", encoding="utf-8") as file:
|
|
for line_number, line in enumerate(file, start=1):
|
|
if line_number%10000 == 0:
|
|
print("==============================================")
|
|
print(line_number)
|
|
print(time.time())
|
|
for table in target_tables:
|
|
if table in line:
|
|
found_lines.append(f"Line {line_number}: {line.strip()}")
|
|
break
|
|
|
|
# 保存匹配结果到文件
|
|
with open(output_file, "w", encoding="utf-8") as outfile:
|
|
outfile.write("\n".join(found_lines))
|
|
|
|
print(f"搜索完成,共找到 {len(found_lines)} 行,结果已保存到 {output_file}")
|