you want it to print the word "time" or the actual time of day? (11:09pm) I dont know if grep has an option like that. You might have to combine it with something like awk.
#more file1.txt
this is line 1 red
this is line 2 orange
this is line 3 yellow
this is line 4 green
this is line 5 blue
this is line 6 purple
this is line 7 blue
this is line 8 red
this is line 9 blue
this is line 10 red
So perhaps you want to grep for the lines with "blue" in them. what do you want your output to look like?
example output
#./script
11:20am this is line 5 blue
11:20am this is line 7 blue
11:20am this is line 9 blue
btw I am just writing this reply to see if i got your question correct. I'm sure theres a very elegant way to do this. Your answer will come shortly I'm sure. People here are VERY good!
---------- Post updated at 01:42 PM ---------- Previous update was at 01:23 PM ----------
or perhaps yoru input file already has the times and you are looking for specific times? example #more file1.txt
11:30am this is line 1
11:30pm this is line 2
11:00am this is line 3
11:00pm this is line 4
11:30am this is line 5
11:40pm this is line 6
11:30am this is line 7
and you want your output to only print the 11:30am lines?
Just trying to be as specific as possible so others can get you exactly the help you need.