tail -f, but only every 1000th row

gies0r :
tail -f myfile.log

is very nice, but if you have a big file you may only want to display every nth row.

So the output will show row 1, row 1001, row 2001 and so on.

Is this possible or do the output needs to be chained into sed, awk or something else?

James Brown :

Using awk:

$ awk 'NR%1000==1'

Sample every 3rd:

$ seq 1 10 | awk 'NR%3==1'
1
4
7
10

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=6585&siteId=1
Row