I have a human written text file that contains time stamps in form of
HH:MM:SS. I have managed to extract time stamps from text file using regex but I would like to also get a line of corresponding time stamp. It would be nice to have time stamps in one file and corresponding lines in the other. There could be multiple time stamps per line so same line should occur multiple times.
If this can be done, what if I want only few words or few lines around a time stamp. Idea is just to get time stamps and their context extracted.
For now I have been using matlab for this, but any *nix tool will do.
Edit: seems to be that not all tools will do. I'm using mac and sometimes portable git bash for windows. At least mac's grep doesn't support anymore -P options for perl regex which is apparently needed for look around
Here is example of original file and desired outputs:
L&L logfile 14-5-12 16-05-2012 Experiment 1 Device 77212-123-123123 Instrument 2, 34g, 66hz Notes: Something weird happened 12:34 Everything is fine 13:07 Log 8:00 routine 1 8:20 routine 2 8:40 routine 3, 8:45 something went south 8:50 routine 4, 8:50:12 weird peak at data
14-5-12 16-05-2012 12:34 13:07 8:00 8:20 8:40 8:45 8:50 8:50:12
14-5-12 16-05-2012 Something weird happened 12:34 Everything is fine 13:07 8:00 routine 1 8:20 routine 2 8:40 routine 3, 8:45 something went south 8:40 routine 3, 8:45 something went south 8:50 routine 4, 8:50:12 weird peak at data 8:50 routine 4, 8:50:12 weird peak at data