简体   繁体   English

如何从bz2文件中提取数据而不解压缩文件

[英]How to extract data from bz2 file without decompress the file

I want to perform the following command in a compressed file (.bz2). 我想在压缩文件(.bz2)中执行以下命令。 I typed the following: 我输入了以下内容:

awk '{print $1}' input.txt.bz2 > output.txt

But the result is: Killed. 但是结果是:被杀死了。 How can I extract portion of the compressed text file I have without decompress it as it is extremely large file and I do not have enough space? 由于压缩文件非常大且没有足够的空间,如何解压缩压缩的文本文件的一部分而不进行解压缩?

You must decompress it. 您必须解压缩它。 You don't need to decompress it to disk. 您无需将其解压缩到磁盘。

bzcat input.txt.bz2 | awk '{print $1}' > output.txt

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

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