This is my sample log file where i like to extract out from a very large log file  2017-05-30 23:11:34,629 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.AuthenticationProviderImpl - Invoking auth agent [accountName=rene1 remoteAddress=STEDGE/172.16.8.3]2017-05-30 23:11:14,638 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.AuthenticationProviderImpl - SSH: Failed login attempt on [172.16.8.1]. Username: rene1.2017-05-30 23:10:54,663 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.KeyboardInteractiveAuthentication - SSH: Sent SSH_MSG_USERAUTH_INFO_REQUEST (Password Authentication): 2017-05-30 23:10:36,415 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.AuthenticationProviderImpl - User login attempt has been made from address /172.16.8.1:582222017-05-30 23:10:36,415 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.AuthenticationProviderImpl - Invoking config agent [accountName=rene1 remoteAddress=/172.16.8.1]2017-05-30 23:10:36,446 INFO [SSHD-TRANSFER-1] com.tumbleweed.st.server.sshd.AuthenticationProviderImpl - Config agent success [accountName=rene1 remoteAddress=/172.16.8.1] I would like to extract out the whole chunk of log from 23:10:36 to 23:11:34 using the sedbut it's fail. I had tested grep and awk but no hope for my expected outcome. It's only give me the log occurred witihin 23:10:36 which i not my expected outcome.This is my command sed -n '/23:10:36/,/23:11:34/p' stlog.txt Anyone know how to let this works? it's only contain time without date because my program will get the current system time only and query the log base on current system time only. 
Set the sed command parameter for a range of time
awk;sed;grep
I can see two issues here: 1) the log seems to be in reverse order, 2) you have multiple lines that match the end pattern. (Though the final line has 23:10:36,446 which is later than 23:10:36,415 on the second-to-last line)With the reverse order, you only get the lines matching 23:10:36 since sed starts printing when it sees that, and continues until it sees 23:11:34, which isn't there. Reversing the patterns (as below) would seem like a solution, but you'd still only get the first line that matches the end pattern, since the printing stops when that pattern is seen the first time.sed -n '/23:11:34/,/23:10:36/p' stlog.txtHere's an awk solution that should be able to work around that issue:awk -vstart=23:11:34 -vend=23:10:36 \  '$0 ~ start {p=1} $0 ~ end {e=1} e && $0 !~ end {p=0} p' stlog.txt The variable p controls printing and is cleared only after the end pattern is seen (e is 1) and the current line no longer matches that pattern.