如何查找末尾包含多个换行符的文件?
How to find files that contain MULTIPLE newlines at their end?
我想查找所有内容末尾有多个换行符的文件。
这怎么可能?
此 bash 命令打印当前目录及其子目录中的所有文件,这些文件在一行或多行序列(即至少两行 \n ):
find . -type f -print | while read a; do tail -2 "$a" | ( read x && read y && [ x"$x" = x ] && echo "$a" ); done
仅供参考:可以使用 PHPStorm 使用 RegEx 搜索词搜索此内容 \n+\n\Z
我想查找所有内容末尾有多个换行符的文件。
这怎么可能?
此 bash 命令打印当前目录及其子目录中的所有文件,这些文件在一行或多行序列(即至少两行 \n ):
find . -type f -print | while read a; do tail -2 "$a" | ( read x && read y && [ x"$x" = x ] && echo "$a" ); done
仅供参考:可以使用 PHPStorm 使用 RegEx 搜索词搜索此内容 \n+\n\Z