Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Parse apache error_log



On Fri, 1 May 2015 15:41:37 +0000 (UTC)
zzapper <david@xxxxxxxxxxxxxx> wrote:
> Don't know if this is a job for zsh or sed etc
> 
> Format:-
> [Fri May 01 16:25:05 2015] [error] [client 172.18.158.61] PHP Parse error:  
> syntax error, unexpected T_VARIABLE 
> 
> I want to grab the date-time of the last entry and then display all the 
> entries with the same date-time.

Well, you *could* do this...

log=wherever
fgrep -h "$(tail -1 $log | sed 's/^\[\([^]]*\)\].*/\1/')" $log

pws



Messages sorted by: Reverse Date, Date, Thread, Author