Shell 正在列出大小大于N的文件

Shell 正在列出大小大于N的文件,shell,unix,awk,grep,Shell,Unix,Awk,Grep,我需要在一个目录下列出所有大小>0的文件(实际上预期文件大小为0)。我如何使用grep和/或awk实现这一点?我在想类似的事情 $ ls -alR | grep ... | awk ... 还有另一个find选项: find . ! -empty 更新:(感谢@steve comment) 如果只需要列出当前目录中的文件: find . -maxdepth 1 -type f ! -empty 请注意,-maxdepth是GNU特性。在POSIX环境中,还有另一种方法: find -ty

我需要在一个目录下列出所有大小>0的文件(实际上预期文件大小为0)。我如何使用grep和/或awk实现这一点?我在想类似的事情

$ ls -alR | grep ... | awk ...

还有另一个
find
选项:

find . ! -empty
更新:(感谢@steve comment)

如果只需要列出当前目录中的文件:

find . -maxdepth 1 -type f ! -empty 
请注意,
-maxdepth
是GNU特性。在POSIX环境中,还有另一种方法:

find -type f -o \( ! -name . -type d -prune -false \) ! -empty

还有另一个
find
选项:

find . ! -empty
更新:(感谢@steve comment)

如果只需要列出当前目录中的文件:

find . -maxdepth 1 -type f ! -empty 
请注意,
-maxdepth
是GNU特性。在POSIX环境中,还有另一种方法:

find -type f -o \( ! -name . -type d -prune -false \) ! -empty