0

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:

  • Is each line [N: ...] written per a constant amount of data read?
  • Are those {M, M} numbers useful for this purpose?
  • Is there any other hint to get the percentage?
axelbrz
  • 783
  • 1
  • 7
  • 16

1 Answers1

1

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

Community
  • 1
  • 1
Alberto Zaccagni
  • 30,779
  • 11
  • 72
  • 106
  • I use Ubuntu 12.04 and I had to install `pv` via `sudo apt-get install pv` to run your suggestion. It is really useful! Anyway, I'll await for another answer to check if it's possible to solve the original question first before marking this answer as the correct one. – axelbrz Nov 11 '15 at 11:53