Bash-查找超过3行的文件列表

问题描述:

我有一个文件目录,并且我想查找包含两行以上文件的列表.

I have a directory of files and I want to find a list of files who has more than 2 lines.

我知道我可以使用wc -l测试每个文件,但是如何将其包装在bash中呢?

I know I can use wc -l to test each file, but how do I wrap it up in bash?

很抱歉,刚开始使用bash的新手问题.

Sorry for the newbie question, new to bash.

您可以使用以下 find 命令:

find . -type f -exec bash -c '[[ $(wc -l < "$1") -gt 2 ]] && echo "$1"' _ '{}' \;