I want to read a log and make some decisions depending on what is happening with my program. My script is based on ffmpeg
and I am redirecting the stdout
to make the log. Then I am reading the log to take decisions. My function is:
YT-PACTIONS()
{
tail -f $MSSLOGS/$project-$intnumber/$project-$intnumber-cache.log | awk '/speed/ { speed=$10 ; print speed ; }'
}
This is not working. It fills the var speed
with the $1
and not the $10
. I tried ${10}
and didn't work either.
If I send the command in the shellscript it works:
tail -f $MSSLOGS/$project-$intnumber/$project-$intnumber-cache.log | awk '/speed/ { speed=$10 ; print speed ; }'
But I have a problem here too. It shows me the result:
speed=1.01
speed=1.01
speed=1.03
speed=1.02
speed=1.01
speed=1.04
But I want to see only the number in the following way:
1.01
1.04
1.03
1.02
1.01
So I have two errors: the $10
first and then to save only numbers in the variable.
Sample log:
CloneNew PasteExpire in 23 h
frame= 279 fps=257 q=30.0 size=N/A time=00:00:05.76 bitrate=N/A dup=111 drop=0 speed=5.3x
frame= 344 fps=214 q=30.0 size=N/A time=00:00:07.06 bitrate=N/A dup=137 drop=0 speed=4.39x
frame= 419 fps=198 q=29.0 size=N/A time=00:00:08.57 bitrate=N/A dup=167 drop=0 speed=4.06x
frame= 526 fps=201 q=29.0 size=N/A time=00:00:10.70 bitrate=N/A dup=210 drop=0 speed=4.09x
frame= 741 fps=116 q=28.0 size=N/A time=00:00:15.04 bitrate=N/A dup=296 drop=0 speed=2.36x
frame= 848 fps=123 q=32.0 size=N/A time=00:00:17.13 bitrate=N/A dup=339 drop=0 speed=2.49x
frame= 1084 fps=147 q=31.0 size=N/A time=00:00:21.86 bitrate=N/A dup=433 drop=0 speed=2.97x
Can someone help?