axelbrz
axelbrz

Reputation: 793

How to get decompression percentage, if possible, from bzcat -vvv

The command bzcat -vvv compressed_file.bz2 > decompressed_file produces in console:

  compressed_file.bz2: 
    [1: huff+mtf rt+rld {0x7ae7dbbc, 0x7ae7dbbc}]
    [2: huff+mtf rt+rld {0x0c85da5f, 0x0c85da5f}]
    [3: huff+mtf rt+rld {0x5e204b89, 0x5e204b89}]
    ...

I would like to know if I can infer the process percentage by reading that output.

For example:

Upvotes: 0

Views: 310

Answers (1)

Alberto Zaccagni
Alberto Zaccagni

Reputation: 31560

I don't know what distribution you're on, on Ubuntu I have pv and I find it pretty useful for this kind of tasks, you could use it as follows:

 pv -cN extracting <compressed_file.bz2 | bzcat >decompressed_file

Is this what you were looking for?

-c, --cursor

Use cursor positioning escape sequences instead of just using carriage returns. This is useful in conjunction with -N (name) if you are using multiple pv invocations in a single, long, pipeline.

-N NAME, --name NAME

Prefix the output information with NAME. Useful in conjunction with -c if you have a complicated pipeline and you want to be able to tell different parts of it apart.

man pv: http://linux.die.net/man/1/pv

Upvotes: 1

Related Questions