I have a log file which gets updated every second. I am grep
'ing some string and pulls that search result to a temp file.
Then I am sending that temp file result to my email.
I am running this script in cron
.
But when the cron triggers the script again and when the script catches the newly searched string, it gives me the previous/old result also in the temp file.
For example my log file looks like below but not exactly:
2018-02-15 14:36:47,344 INFO : Bread butter jam
2018-02-15 14:37:22,566 INFO : trees
2018-02-15 14:37:22,636 INFO : fruits
2018-02-15 14:37:22,636 INFO : veggies
2018-02-15 14:37:22,745 INFO : junkies
2018-02-15 14:37:23,648 INFO : Bread butter jam
2018-02-15 14:37:23,659 INFO : cakes
2018-02-15 14:37:23,734 INFO : cookies
2018-02-15 14:37:23,767 INFO : meat
2018-02-15 14:37:23,874 INFO : yogurt
I want Bread butter jam to be stored in a temp file each time when it comes in the log file.
How to pull only the newly searched result to the temp file?
Sorry for my bad English and I am new to bash.