简体   繁体   English

从Notepad ++文件中删除行号

[英]Remove Line numbers from Notepad++ file

I have received a very long file. 我收到了一个很长的文件。 It has 1000+ lines of SQL code. 它有1000多行SQL代码。 Each line start with line number. 每行以行号开头。

14      PROCEDURE sp_processRuleset(pop_id IN NUMBER);
15  
16       -- clear procedure for preview mode to clean crom_population_member_temp table and global variables
17       PROCEDURE sp_commit; -- 28-Oct-09 J.Luo
18  
19       -- The rule Set string for the Derived Population Member Preview
20       -- The preview mode will set gv_context_ruleSet by setContext_ruleSet,
21       -- sp_processRuleset uses gv_context_ruleSet to build derived population instead of getting rules from crom_rule_set table
22       gv_context_ruleSet VARCHAR2(32767) := NULL;  -- 27-Oct-09 J.Luo
23          -- The population Role Id for the Derived Population Member Preview

I want to remove only line numbers using NotePad++ Find+Replace functionality. 我想使用NotePad ++ Find + Replace功能仅删除行号。 Is there any regex available to get this done ? 是否有任何正则表达式可以完成这项工作?

This using regex is the easiest way. 使用正则表达式是最简单的方法。

Other handy way (scrolling a 1K lines is not much IMO) could be : 其他方便的方式(滚动1K行不是很多IMO)可能是:

Block Selection using ALT key and dragging your mouse, like following: 使用ALT键和拖动鼠标进行块选择 ,如下所示:

在此输入图像描述

You can use this regex: 你可以使用这个正则表达式:

^\d+

Working demo 工作演示

Open Replace window with CTRL + H and run Replace All with these settings: 使用CTRL + H打开替换窗口并使用以下设置运行全部替换

  1. Find what: ^\\s*\\d+ 找到: ^\\s*\\d+
  2. Replace with: (empty) 替换为:(空)
  3. Search mode: Regular expression 搜索模式:正则表达式

Notes: 笔记:

  • \\s can also be [[:space:]] or [ \\t] \\s也可以是[[:space:]][ \\t]
  • \\d can also be [[:digit:]] or [0-9] \\d也可以是[[:digit:]][0-9]
  • If the new edit is correct, the pattern \\s* that matches the leading space may not be needed. 如果新编辑正确,则可能不需要与前导空格匹配的模式\\s*

如果数字后面有冒号,你可以使用这个

^\d+:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM