How can I read lines at a fixed speed?
pv
, which is available as a NetBSD package, lets you limit the rate of a pipe.
<large_file pv -L 1k | netcat …
As it turns out, pv
is the perfect tool here (at least pv 1.6.0). With the -l
(line mode) flag, -L
limits become lines.
Simple proofs:
seq 0 1000|pv -l -L100 > /dev/null
1k 0:00:10 [99.6 /s] [ <=>
seq 0 10000|pv -l -L1k > /dev/null
10k 0:00:09 [1.03k/s] [ <=>