Isso funciona para mim:
grep "\[17-10" filename | grep "15:0[1-8]"
Eu quero extrair infromation de logs usando um script de shell para um intervalo de tempo específico. Uma linha nos registros se parece com isso:
[15:01:27:176][15-10-2015]: testing1-vidya-Thu Oct 15 11:49:27 IST 2015
[15:02:27:178][15-10-2015]: testing2-vidya-Thu Oct 15 11:49:27 IST 2015
[15:10:27:179][15-10-2015]: testing3-vidya-Thu Oct 15 11:49:27 IST 2015
[15:01:27:180][16-10-2015]: testing4-vidya-Thu Oct 15 11:49:27 IST 2015
[15:20:27:181][16-10-2015]: testing5-vidya-Thu Oct 15 11:49:27 IST 2015
[15:02:27:182][16-10-2015]: testing6-vidya-Thu Oct 15 11:49:27 IST 2015
[15:03:27:183][17-10-2015]: testing7-vidya-Thu Oct 15 11:49:27 IST 2015
[15:04:27:184][17-10-2015]: testing8-vidya-Thu Oct 15 11:49:27 IST 2015
[15:05:27:191][17-10-2015]: testing9-vidya-Thu Oct 15 11:49:27 IST 2015
[15:18:27:192][17-10-2015]: testing10-vidya-Thu Oct 15 11:49:27 IST 2015
[15:29:27:193][17-10-2015]: testing11-vidya-Thu Oct 15 11:49:27 IST 2015
[15:03:27:208][18-10-2015]: testing12-vidya-Thu Oct 15 11:49:27 IST 2015
[15:04:27:209][18-10-2015]: testing13-vidya-Thu Oct 15 11:49:27 IST 2015
[15:07:27:210][18-10-2015]: testing14-vidya-Thu Oct 15 11:49:27 IST 2015
Eu preciso extrair dados em intervalos específicos. por exemplo, entre 15:01 e 15:08 na data [17-10-2015]
[15:03:27:183][17-10-2015]: testing7-vidya-Thu Oct 15 11:49:27 IST 2015 [15:04:27:184][17-10-2015]: testing8-vidya-Thu Oct 15 11:49:27 IST 2015 [15:05:27:191][17-10-2015]: testing9-vidya-Thu Oct 15 11:49:27 IST 2015
Eu usei este código:
grep -E "^[(15:0[1-8])" | grep '[17-10' filename
Eu tentei isso. Eu estou recebendo todos os dados de 17-10-2015 incluindo 15:18 e 15: 29. Preciso apenas de dados das 15:01 às 15:08. Está correto, alguma coisa errada nisso?
Isso funciona para mim:
grep "\[17-10" filename | grep "15:0[1-8]"