[GTALUG] Cool, but obscure unix tools :: Software architect Kristof Kovacs

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Fri Mar 20 14:46:43 UTC 2015


On Fri, Mar 20, 2015 at 10:10:35AM -0400, Jamon Camisso wrote:
> Ah good point - the progress bar isn't accurate the way that I use
> it with zcat. I don't suppose there's a way to make that work with a
> stream is there?

If you happen to know the size, you can tell pv with an argument what
it is, but otherwise, no.

Of course you could do:

pv db.sql.gz | zcat | yoursqlengine

Then the progress will be based on the compressed data rather than
uncompressed, but that might be fine in most cases.  Sure if you have
a huge gob of highly compressed data in the middle, it might slow down
the processing at the end of the pipe and your progress would be off,
but that's probably an unusual case.

So yes, it is hard to do progress bars well if you don't know how much
work you are going to do before you finish doing it.

-- 
Len Sorensen


More information about the talk mailing list