Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Unix/Linux中查找具有固定文件大小(>;0)的文件_Linux_Unix_Find - Fatal编程技术网

在Unix/Linux中查找具有固定文件大小(>;0)的文件

在Unix/Linux中查找具有固定文件大小(>;0)的文件,linux,unix,find,Linux,Unix,Find,我有一个这样的文件列表 4 -rw-r--r-- 1 neversaint hgc0746 53 May 1 10:37 SRX016372-SRR037477.est_count 4 -rw-r--r-- 1 neversaint hgc0746 53 May 1 10:34 SRX016372-SRR037478.est_count 4 -rw-r--r-- 1 neversaint hgc0746 53 May 1 10:4

我有一个这样的文件列表

  4 -rw-r--r-- 1 neversaint hgc0746         53 May  1 10:37 SRX016372-SRR037477.est_count
  4 -rw-r--r-- 1 neversaint hgc0746         53 May  1 10:34 SRX016372-SRR037478.est_count
  4 -rw-r--r-- 1 neversaint hgc0746         53 May  1 10:41 SRX016372-SRR037479.est_count
  0 -rw-r--r-- 1 neversaint hgc0746          0 Apr 27 11:16 SRX003838-SRR015096.est_count
  0 -rw-r--r-- 1 neversaint hgc0746          0 Apr 27 11:32 SRX004765-SRR016565.est_count
我要做的是找到大小正好为
53
的文件。但是为什么这个命令失败了呢

$ find . -name "*.est_count" -size 53 -print
但如果我只想使用以下命令查找大小为0的文件,则效果良好:

 $ find . -name "*.est_count" -size 0 -print

您需要在53号后面加上“c”。根据find的主页-

-size n[cwbkMG]
          File uses n units of space.  The following suffixes can be used:

          `b'    for 512-byte blocks (this is the default if no suffix  is
             used)

          `c'    for bytes

          `w'    for two-byte words

          `k'    for Kilobytes (units of 1024 bytes)

          `M'    for Megabytes (units of 1048576 bytes)

          `G'    for Gigabytes (units of 1073741824 bytes)

          The  size  does  not  count  indirect  blocks, but it does count
          blocks in sparse files that are not actually allocated.  Bear in
          mind  that the `%k' and `%b' format specifiers of -printf handle
          sparse  files  differently.   The  `b'  suffix  always   denotes
          512-byte  blocks and never 1 Kilobyte blocks, which is different
          to the behaviour of -ls.

您需要使用-size 53c。

这是我在Mac OS 10.5上得到的

> man find
...
-size n[c]
         True if the file's size, rounded up, in 512-byte blocks is n.  If n
         is followed by a c, then the primary is true if the file's size is n
         bytes (characters).

尺寸是多少?它是磁盘上的大小还是大小?
> man find
...
-size n[c]
         True if the file's size, rounded up, in 512-byte blocks is n.  If n
         is followed by a c, then the primary is true if the file's size is n
         bytes (characters).