remove blank line at the end of a text file converted from an excel file

久未见 提交于 2020-05-14 02:48:43

问题


So I have an excel table that I am converting to a tab delimited txt file. The only problem is that at the end of the converted file, there is a blank line. How can i get this to go away automatically?


回答1:


To remove the last empty lines you may use \R+\z regex and replace with nothing.

To remove the last blank line you may use \R\h*\z regex and replace with nothing.

Note that in general you may use

Edit -> Line Operations -> Remove Empty Lines

to remove all empty lines anywhere inside the file.

NOTES on regex:

  • \R - matches a linebreak (CRLF, or CR, or LF)
  • \R+ - one or more linebreaks
  • \h* - zero or more (*) horizontal whitespaces
  • \z - the very end of the file


来源:https://stackoverflow.com/questions/38721957/remove-blank-line-at-the-end-of-a-text-file-converted-from-an-excel-file

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