Command-line tool to measure how fast a file is growing?

4

1

Is there a command-line tool to measure how fast a text file is growing, in units of lines/second?

For small-ish files, I can do something with watch and wc -l, but that measures the file anew each time. Usually I want to watch either a huge log file, or a pipeline.

If there was a tool that just read stdin, and every second it spat out how many newlines it had read during the past second, that'd be perfect.

It's probably pretty easy to throw something together in one of my HLLs of choice, but if there's an existing tool that does this, all the better.

Ken

Posted 2010-12-15T23:28:07.183

Reputation: 225

Answers

6

You're looking for pv (pipe viewer), available on or at least for most unices.

data-producer | pv | data-consumer
tail -f logfile | pv -l

Gilles 'SO- stop being evil'

Posted 2010-12-15T23:28:07.183

Reputation: 58 319