Sed range problem if the last pattern is not met
Clash Royale CLAN TAG #URR8PPP up vote 0 down vote favorite I am doing a range search with sed. I want to parse the log data from the date and time 2016-09-29 01:00 to 2016-09-29 01:30 . That is why I have been using the following command, $ sed -n '/2016-09-29 01:/,/2016-09-29 01:30:.*$/p' But problem is if 1:30 is not available in log then it returns all the logs to the end. So how can work with this so that if 1:30 doesn't exist it will go to the just next record not till end. Things to consider: Logs contains stack trace so lines contain stack trace doesn't start with the date. sed regular-expression date share | improve this question edited Aug 29 at 11:23 asked Aug 29 at 11:03 muhammad 499 5 14 add a comment  | up vote 0 down vote favorite I am doing a range search with sed. I want to parse the log data from the date and time 2016-09-29 01:00 to 2016-09-29 01:30 . That is why I h...