Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a cat/tac stream at given line/second rate? [closed]

Tags:

linux

shell

imagine you have a big logfile named "filename"

if you tail -f filename then you have a stream only if filename updates itself

if you cat filename then you have a stream, but cannot read it if you CPU is newer than intel 8088

if you cat filename | more then you have a stream, page by page, and will probably break your space key

How can i list a file at a given rate (ex: 1 line each 0.05 second) so i have time to read, but i don't need to press space key hundreds of time ?

(i don't use | grep because in my particuliar case, i don't know exactly what to search for)

like image 734
comte Avatar asked Nov 30 '22 01:11

comte


1 Answers

yes | pv --quiet --rate-limit 10

I used yes here to get a fast source of text; pv is an extremely useful tool for many reasons, but one of its features is a rate limiter. You need to tell it to be quiet so it doesn't print its progress indicator. The limit is in bytes per second.

See also: https://superuser.com/questions/526242/cat-file-to-terminal-at-particular-speed-of-lines-per-second

like image 173
John Zwinck Avatar answered Dec 04 '22 05:12

John Zwinck