注意:这个问题以前的措辞不同,使用“带/不带换行符”而不是“带/不带空行”
我有两个文件,一个带有空行,一个没有:
文件:text_without_empty_line
$root@kali:/home#cat text_without_empty_line
This is a Testfile
This file does not contain an empty line at the end
$root@kali:/home#
文件:text_with_empty_line
$root@kali:/home#cat text_with_empty_line
This is a Testfile
This file does contain an empty line at the end
$root@kali:/home#
有没有命令或函数可以检查文件末尾是否有空行? 我已经找到了这个解决方案,但对我没用。(编辑:忽略:使用preg_match和PHP的解决方案也可以。)