如何在记事本++中的特定字符断行?
我有一个文本文件包含像这样的文本:
['22APR2012 23:10', '23APR2012 07:10', 1, 3, 0], ['22APR2012 23:10', '23APR2012 07:20', 1, 3, 0], ['22APR2012 23:15', '23APR2012 06:40', 0, 1, 0], ['22APR2012 23:15', '23APR2012 06:40', 1, 3, 0], ['22APR2012 23:15', '23APR2012 06:40', 0, 1, 0], ['22APR2012 23:15', '23APR2012 07:00', 1, 3, 0], ['22APR2012 23:15', '23APR2012 07:00', 0, 1, 0], ['22APR2012 23:20', '23APR2012 09:35', 0, 1, 0], ['22APR2012 23:20', '23APR2012 09:35', 1, 3, 0], ['22APR2012 23:20', '23APR2012 10:10', 1, 3, 0], ['22APR2012 23:25', '23APR2012 05:35', 1, 3, 0],
我想要的行在],字符:
['22APR2012 19:30', '23APR2012 00:25', 0, 1, 0], ['22APR2012 19:35', '23APR2012 01:45', 1, 3, 0], ['22APR2012 19:50', '23APR2012 05:25', 1, 3, 0], ['22APR2012 19:50', '23APR2012 05:25', 0, 1, 0], ['22APR2012 19:55', '23APR2012 06:25', 1, 3, 0],
有没有办法在Notepad ++或任何其他编辑器中做到这一点?
- 点击顶部菜单上的Ctrl + h或search – >replace
- 在search模式组下,select正则expression式
- 在查找文本字段中input
],\s* - 在replace为文本字段中,input
],\n - 点击全部replace
如果文本包含需要转换为新行的\ r \ n ,请使用“扩展”或“正则expression式”模式,并在“查找内容”中转义反斜线字符:
find: \\ r \\ n
replace为: \ r \ n
- 打开
notePad++ - 打开
Find windowCtrl + F - 切换到
Replace标签 - select
Search Mode进行Extended - 在
Find What字段中input] - 在
Replace with字段中键入\n - 点击
Replace All - 繁荣
我不知道如何自动工作,但你可以复制“],”与新行一起,然后使用replacefunction。
如果您正在使用CR LF将逗号分隔的string转换为列,则无法在Notepad ++中执行此操作,假设您不想编写代码,则可以在Microsoft Excel中对其进行操作。
如果您将string复制到位置B1:
A2 =LEFT(B1,FIND(",",B1)-1) B2 =MID(B1,FIND(",",B1)+1,10000)
selectA2和B2,将代码复制到连续单元格(通过拖动):
A3 =LEFT(B2,FIND(",",B2)-1) B3 =MID(B2,FIND(",",B2)+1,10000)
当你获得#VALUE! 在列A的最后一个单元格中,将其replace为之前的行B值。
最后你的A列将包含所需的文字。 复制并将其放在任何你想要的地方。