From owner-freebsd-questions@FreeBSD.ORG Thu Nov 5 14:26:16 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F19E10656B0 for ; Thu, 5 Nov 2009 14:26:16 +0000 (UTC) (envelope-from af.gourmet@videotron.ca) Received: from relais.videotron.ca (relais.videotron.ca [24.201.245.36]) by mx1.freebsd.org (Postfix) with ESMTP id AE3B48FC15 for ; Thu, 5 Nov 2009 14:26:15 +0000 (UTC) MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; charset=UTF-8 Received: from [192.168.0.51] ([96.21.103.185]) by VL-MO-MR002.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-4.01 (built Aug 3 2007; 32bit)) with ESMTP id <0KSN00IH843QNN90@VL-MO-MR002.ip.videotron.ca> for freebsd-questions@freebsd.org; Thu, 05 Nov 2009 09:26:14 -0500 (EST) Message-id: <4AF2D277.3090406@videotron.ca> Date: Thu, 05 Nov 2009 09:26:15 -0400 From: PJ User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) To: Polytropon References: <4AF1FF76.60808@videotron.ca> <20091105023045.9a3d90ab.freebsd@edvax.de> In-reply-to: <20091105023045.9a3d90ab.freebsd@edvax.de> Cc: "freebsd-questions@freebsd.org" Subject: Re: and now for conky & gremlins X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2009 14:26:16 -0000 Polytropon wrote: > On Wed, 04 Nov 2009 18:25:58 -0400, PJ wrote: > >> output should be: 1 2 3 [4] 5 6 7 etc. >> is: 1 2 3 4 5 6.... >> >> the calendar.sh is exactly: >> #!/bin/sh >> cal | awk 'NR>1' | sed -e 's/ / /g' -e 's/[^ ] /& /g' -e 's/..*/ >> &/' -e "s/\ `date +%d`/\[`date +%d`\]/" >> > > It's quite obviously. Let's try the last substitution > argument in plain shell: > > % date +%d > 05 > > But the command creates this: > > Su Mo Tu We Th Fr Sa > 1 2 3 4 5 6 7 > > The leading zero is missing, so there's no substition that > changes "5" into "[5]", because the search pattern is "05". > Ok, I see... I'm not too good in programming. I guess I didn't notice the previous to the first days of November the date was always 2 digits.. how do I get rid of the zero? Regex substitution or something like that?