I want to develop a shell script but with a bit complicated conditions. I have a file contains a data. The data change every 5 mins.
If the file having data repeated 3 times then add 5 to the counter. By using crontab I will let the script check the file again and if the same 3 data are exist then add another 5 till it reach to 40. Another condition if one of the check dose not have the same repeatative data then the counter should be reset. We may have more than one repetative data then another counter should be start.
ex. file name is ( Main ) and the data is as follow:
NBB001
NBB001
NBB001
TTF033
and because the data changes we might have another data like
NBB001
BFG123
and another ex.
NBB001
NBB001
NBB001
TTF033
TTF033
TTF033
what I want basicly is to have counter running every time i check the file and if it reach to 40 then do some command and if reach 60 do another command. As above if data not continusly available the ounter should be reset and if there is more than one data repeated 3 times then another counter should work.
Appreciate your help