简体   繁体   English

从记事本++文件中删除最后一行

[英]Deleting last line from notepad++ files

I am having a small problem regarding removal of last line from text files. 关于从文本文件中删除最后一行有一个小问题。 I have over 500 text files and in each of them the last line is simply blank. 我有超过500个文本文件,在每个文件中,最后一行只是空白。 I want to find some quick method to delete these empty lines. 我想找一些快速删除这些空行的方法。 I am looking for some search and replace method to remove these lines. 我正在寻找一些搜索和替换方法来删除这些行。 每个文件末尾都有空行

So far I have tried searching \\r\\n and other methods but nothing works. 到目前为止,我已经尝试搜索\\r\\n和其他方法,但没有任何作用。 Only thing that works is by going to edit->line operations-> Remove Empty Lines but it is cumbersome to do this individually for each file. 唯一有效的方法是通过编辑 - >行操作 - >删除空行,但为每个文件单独执行此操作很麻烦。

So is there any way to achieve this? 有没有办法实现这个目标?

Ahmar 艾哈迈尔

Have a try with: 试试看:

Find what: \\n$ 找到什么: \\n$
Replace with: NOTHING 替换为:没有

Use the regular expression \\r\\n\\Z. 使用正则表达式\\ r \\ n \\ Z.

Search > Find in Files. 搜索>在文件中查找。 You're looking for \\r\\n\\Z, replace with nothing, and make sure Regular Expression is checked at the bottom. 您正在寻找\\ r \\ n \\ Z,无需替换,并确保在底部选中正则表达式。

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

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