user2192774
user2192774

Reputation: 3907

How to extract data from bz2 file without decompress the file

I want to perform the following command in a compressed file (.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?

Upvotes: 2

Views: 3887

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798546

You must decompress it. You don't need to decompress it to disk.

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

Upvotes: 5

Related Questions