Removing empty lines in Notepad++

前端 未结 22 1760
时光取名叫无心
时光取名叫无心 2020-11-28 00:04

How can I replace empty lines in Notepad++? I tried a find and replace with the empty lines in the find, and nothing in the replace, but it did not work; it probably needs r

相关标签:
22条回答
  • 2020-11-28 00:59
    1. Edit >> Blank Operations >> Trim Leading and Trailing Spaces (to remove black tabs and spaces in empty lines)
    2. Ctrl + H to get replace window and replace pattern: ^\r\n with nothing (select regular expression)

    Note: step 1 will remove your code intendation done via tabs and blank spaces

    0 讨论(0)
  • 2020-11-28 01:03
    1. notepad++
    2. Ctrl-H
    3. Select Regular Expression
    4. Enter ^[ \t]*$\r?\n into find what, leave replace empty. This will match all lines starting with white space and ending with carriage return (in this case a windows crlf)
    5. Click the Find Next button to see for yourself how it matches only empty lines.
    0 讨论(0)
  • 2020-11-28 01:04

    It's very Simple ## No need of any extra plugin

    You know what, now Notepad ++ has inbuilt functionality to do so...

    1. Open EDIT Menu by: Alt+E > Press down Arrow > Line Operations > Remove Empty Lines

    1. Other Option is to use Replace press: ctrl + H

    Find : \r\n\r\n

    Replcate with : \r\n

    0 讨论(0)
  • 2020-11-28 01:05

    You can follow the technique as shown in the following screenshot:

    • Find what: ^\r\n
    • Replace with: keep this empty
    • Search Mode: Regular expression
    • Wrap around: selected

    NOTE: for *nix files just find by \n

    0 讨论(0)
提交回复
热议问题