I need to scroll through the lines of the n file and for any i between 1 and n - 1 get the difference line(n - 1) - line(n) .
And here is the source file:
root@syncro:/var/www# cat cron.log | grep "/dev/vda" /dev/vda 20418M 14799M 4595M 77% / /dev/vda 20418M 14822M 4572M 77% / /dev/vda 20418M 14846M 4548M 77% / /dev/vda 20418M 14867M 4527M 77% / /dev/vda 20418M 14888M 4506M 77% / /dev/vda 20418M 14910M 4484M 77% / /dev/vda 20418M 14935M 4459M 78% / /dev/vda 20418M 14953M 4441M 78% / /dev/vda 20418M 14974M 4420M 78% / /dev/vda 20418M 15017M 4377M 78% / /dev/vda 20418M 15038M 4356M 78% / root@syncro:/var/www
these lines /dev/vda... are registered hourly with df -BM in the cron.log file, and the difference between the lines will indicate the consumption of the clock disk.
So, the expected result will be:
23 (4595 - 4572) 24 (4572 - 4548) ... 43 (4420 - 4377) 21 (4377 - 4356)
I do not need the text between ( and ) , I put it here just for explanation.
linux bash line difference
SYNCRo
source share