I have a programm which is working in Linux terminal. When it is running the data are outputting into a terminal window, the data are changing every second.
Example of the window:
a b c d
d b c a
c a d b
Data from machine 2 - time: 15:29:31
11 13 17 18 #changing lines
21 18 17 16 #changing lines
18 17 11 9 #changing lines
I'd like to log the data from the window with 10 minutes interval into 1 file. What should be a Bash script, which can read the content of the window, every ten minutes parse it for line 4 and below and append it into 1 file?
Example of desired result - log.txt:
Data from machine 2 - time: 15:40:00
58 47 61 34
17 8 3 2
Data from machine 2 - time: 15:50:00
5 7 8 12
35 41 70 25
33 41 11 14
Data from machine 2 - time: 16:00:00
12 14 15 16
13 18 19 20
24 21 22 23
The second part of this task to my mind could be solved something like this: grep -A 100 "Data from machine " ... | tail -n +2 >> log.txt (don't know what should be instead of ...) But concerning the first part there is more unclear. May be I should see the topic of STDOUT. Need your help.