In bash I am trying to read a log file and will print only the lines that have a timestamp between two specific times. The time format is hh:mm:ss. For example, I would be searching for lines that would fall between 12:52:33 to 12:59:33.
I want to use regular expression because I can use it in grep function.
Each log line begins with some_nr 2014-05-15 21:58:00,000000 rest_of_line.
My solution gives me lines with 1 min margin. I cut out ss and take all lines with hh:mm:[0-9]{2}. $2 has format filename_hh:mm:; for example: "24249_16:05:;24249_16:05:;24249_16:07:;24249_16:07:;24249_16:08:"
My code:
B=$2  
for line in ${B//;/ } ;
do  
    TENT=`echo $line | awk '{split($0,numbers,"_"); print numbers[1]}'`"_logs.txt"
    TIME=`echo $line | awk '{split($0,numbers,"_"); print numbers[2]}'`"[0-9]{2}"
    grep -iE ${TIME} ${TENT} >> ${FILE1}
done
I need a solution with 15 sec margin for any time not 60. I want to have input in format filename_hh:mm:ss and take lines for hh:mm:ss +/- 15s or filename_hh:mm:ss(1)_hh:mm:ss(2) and take lines between hh:mm:ss(1) and hh:mm:ss(2). For sometime there is no lines so the solution should 'recognize' if sometimes match inputted interval or not. 
Log files look like this:
1002143 1002143 2014/15/05 22:09:52.937004 bla 
1002130         2014/15/05 22:09:44.786002 bla bla
1001667         2014/15/05 22:09:44.592009 bl a bla
1001667 1001667 2014/15/05 22:09:44.592009 bl a bla
 
     
     
     
     
     
     
    