记录一下

使用EXCEL向Typecho导入大量文章时,\r\n会原样输出

样本

解决办法:
替换字符

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20


-- 替换换行符
update `jieshuo` set content = REPLACE(content, '\\r', char(13));
update `jieshuo` set content = REPLACE(content, '\\n', char(10));
update `jieshuo` set name = REPLACE(name, '.txt', '');

SELECT * FROM jieshuo limit 1,20


-- 插入文章
INSERT INTO typecho.typecho_contents (title,slug,created,modified,text,authorId) SELECT name as title,name as slug, 1693656940 as created, 1693656940 as modified, content as text,1 AS authorId FROM solo.jieshuo


-- 设置分类


INSERT INTO typecho.typecho_relationships (cid,mid) SELECT cid,4 as mid FROM typecho.typecho_contents WHERE cid >=18


备份 文章