简体   繁体   English

如何使用find过滤ls输出

[英]how to filter ls output using find

I am trying to filter ls output to only extract those files that have size more than 10k. 我试图过滤ls输出只提取那些大小超过10k的文件。 In other words i want all those files that have file size of greater than 0. Here are the list of files that i am trying to filter 换句话说,我想要所有文件大小都大于0的文件。以下是我试图过滤的文件列表

-rw-r--r-- 1 udevisetty services  455 Sep 19 13:53 RIL_131.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services    0 Sep 17 01:37 RIL_136.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services    0 Sep 18 02:34 RIL_143.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services    0 Sep 19 06:32 RIL_147.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services 1.4K Sep 19 15:05 RIL_150.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services  331 Sep 19 15:00 RIL_15.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services    0 Sep 17 21:18 RIL_171.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services    0 Sep 19 13:41 RIL_175.01.bwa_tophat.err
-rw-r--r-- 1 udevisetty services 1.5K Sep 19 15:13 RIL_176.01.bwa_tophat.err

Here is the command i am trying with no success. 这是我尝试的命令没有成功。

find . -type f -size +10 -name "*.err"

Any help! 任何帮助!

To find all the files that are at least 10k, try this (you didn't specify the units so it used the default b , which is 512-byte blocks): 要查找至少10k的所有文件,请尝试此操作(您没有指定单位,因此它使用默认b ,即512字节块):

find . -type f -size +10k

Use this to list of all non-empty files: 使用此列表列出所有非空文件:

find . -type f ! -size 0

To see ls output of those files, do something like this: 看到ls这些文件的输出,这样做:

find . -type f ! -size 0 -exec ls -l '{}' \;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM