You're viewing a comment by goutam and its responses.

May 26, 2016, 07:47

Hi There,

as we know to get a range of value we can use
sed '/start/,/end/' filename
however this is not working when we are dealing with time stamp.

let say i have a logfile having various lines along with some timestamps.
i want only particular lines between 2 different times.
i tried with
sed -n '/02:41:56/,/02:41:59/' logfile

it did not work.
also tried with

# stime="05/26/2016 02:41:56"
# etime="05/26/2016 02:41:59"
# sed -n '/$stime/,/$etime/' logfile
Unrecognized command: /$stime/,/$etime/

Please help,

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "quake3_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.