如何计算存档文件夹中文件的一些数据?

How to take count some data of a file which is in archived folder?

我有一个包含一些文件的存档文件夹,其中一个文件我想计算 31 个分隔符。如何在不解压缩文件夹的情况下进行计数?

存档文件夹名=mug.tar,文件名=APR_17

下面是如何计算

| awk -F "|" '{print }'|grep "40411"|sort -n|uniq -c|wc –l

将存档文件中的所需文件解压到 stdout 并将其通过管道传输到您的 awk 中:

$ tar -xOf mug.tar APR_17 | awk ...

man tar:

 -x, --extract, --get
       extract files from an archive

 -O, --to-stdout
       extract files to standard output

 -f, --file ARCHIVE
       use archive file or device ARCHIVE