在unix中搜索两个时间之间的记录

时间:2013-01-02 06:08:37

标签: unix

start_time=22:15:14 (second line)
end_time=01:05:15 ( last but one)

我希望在这些时间之间记录所有这些记录。

Jan 3 22:14:14 Program: p1: PID=1681586: Thread 9 - Record type=1 (p1a): 0 processed OK, 0 failed
Jan 3 22:15:14 Program: p1: PID=1681586: Thread 9 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 3 22:16:14 Program: p1: PID=1681586: Thread 9 - Record type=3 (p1c): 2 processed OK, 4 failed
Jan 3 22:17:14 Program: p1: PID=1681586: Thread 9 - Record type=4 (p1d): 0 processed OK, 0 failed
Jan 3 22:17:14 Program: p1: PID=1664884: Thread 5 - Record type=1 (p1a): 0 processed OK, 0 failed
Jan 3 22:17:14 Program: p1: PID=1664884: Thread 5 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 3 22:17:14 Program: p1: PID=1664884: Thread 5 - Record type=3 (p1c): 3 processed OK, 5 failed
Jan 3 22:17:14 Program: p1: PID=1664884: Thread 5 - Record type=4 (p1d): 0 processed OK, 0 failed
Jan 3 22:17:15 Program: p1: PID=1663618: Thread 14 - Record type=1 (p1a): 0 processed OK, 0 failed
Jan 3 22:17:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 4 01:17:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 4 01:17:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 4 01:17:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 4 01:05:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed
Jan 4 01:17:15 Program: p1: PID=1663618: Thread 14 - Record type=2 (p1b): 0 processed OK, 0 failed

1 个答案:

答案 0 :(得分:1)

sed '/start_time=hh:mm:ss/,/end_time=hh:mm:ss/' your_log_file