Remove Line numbers from Notepad++ file

吃可爱长大的小学妹 提交于 2020-01-23 08:06:05

问题


I have received a very long file. It has 1000+ lines of SQL code. 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. Is there any regex available to get this done ?


回答1:


This using regex is the easiest way.

Other handy way (scrolling a 1K lines is not much IMO) could be :

Block Selection using ALT key and dragging your mouse, like following:




回答2:


You can use this regex:

^\d+

Working demo




回答3:


Open Replace window with CTRL+H and run Replace All with these settings:

  1. Find what: ^\s*\d+
  2. Replace with: (empty)
  3. Search mode: Regular expression

Notes:

  • \s can also be [[:space:]] or [ \t]
  • \d can also be [[:digit:]] or [0-9]
  • If the new edit is correct, the pattern \s* that matches the leading space may not be needed.



回答4:


You can use this one if you have colon after numbers

^\d+:


来源:https://stackoverflow.com/questions/25174602/remove-line-numbers-from-notepad-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!