Change EOL on multiple files in one go

后端 未结 7 1304
再見小時候
再見小時候 2020-11-29 19:34

Is there any way in Notepad++ (or even with another tool) to change the line ending automatically on multiple files in one go?

i.e. convert a mix of

相关标签:
7条回答
  • 2020-11-29 20:02

    Use the 'Find In Files' feature (Ctrl + Shift + F). Change the search mode at the bottom left to 'Regular Expression'.

    In the 'Find what' box, use this pattern:

    (?<!\r)\n
    

    Replace with:

    \r\n
    

    Choose your directory and specify any file type filters. Check 'In all sub-folders' if you want. Click 'Replace in Files'.

    What this does is replace any newline characters (\n) that are not currently preceded by a carriage return (\r) with \r\n. So it won't match line endings that are already Windows style.

    enter image description here

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