From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1417 invoked by alias); 1 May 2015 21:03:20 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20175 Received: (qmail 9917 invoked from network); 1 May 2015 21:03:15 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-Originating-IP: [80.3.228.158] X-Spam: 0 X-Authority: v=2.1 cv=AoZg3YNP c=1 sm=1 tr=0 a=P+FLVI8RzFchTbbqTxIDRw==:117 a=P+FLVI8RzFchTbbqTxIDRw==:17 a=kj9zAlcOel0A:10 a=NLZqzBF-AAAA:8 a=22Ro6XbQAAAA:8 a=re8zQK8XDKBnGpoPhTgA:9 a=CjuIK1q_8ugA:10 Date: Fri, 1 May 2015 22:03:11 +0100 From: Peter Stephenson To: zsh-users@zsh.org Subject: Re: Parse apache error_log Message-ID: <20150501220311.6f101a62@ntlworld.com> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 1 May 2015 15:41:37 +0000 (UTC) zzapper 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