From owner-freebsd-questions@FreeBSD.ORG Thu Nov 5 14:46: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 AC7BC106568B for ; Thu, 5 Nov 2009 14:46:16 +0000 (UTC) (envelope-from mail25@bzerk.org) Received: from ei.bzerk.org (tunnel490.ipv6.xs4all.nl [IPv6:2001:888:10:1ea::2]) by mx1.freebsd.org (Postfix) with ESMTP id 226E98FC18 for ; Thu, 5 Nov 2009 14:46:15 +0000 (UTC) Received: from ei.bzerk.org (BOFH@localhost [127.0.0.1]) by ei.bzerk.org (8.14.2/8.14.2) with ESMTP id nA5Ek9Ym029006; Thu, 5 Nov 2009 15:46:09 +0100 (CET) (envelope-from mail25@bzerk.org) Received: (from bulk@localhost) by ei.bzerk.org (8.14.2/8.14.2/Submit) id nA5Ek9pR029005; Thu, 5 Nov 2009 15:46:09 +0100 (CET) (envelope-from mail25@bzerk.org) Date: Thu, 5 Nov 2009 15:46:09 +0100 From: Ruben de Groot To: PJ Message-ID: <20091105144609.GA28950@ei.bzerk.org> Mail-Followup-To: Ruben de Groot , PJ , Polytropon , "freebsd-questions@freebsd.org" References: <4AF1FF76.60808@videotron.ca> <20091105023045.9a3d90ab.freebsd@edvax.de> <4AF2D277.3090406@videotron.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4AF2D277.3090406@videotron.ca> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on ei.bzerk.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (ei.bzerk.org [127.0.0.1]); Thu, 05 Nov 2009 15:46:14 +0100 (CET) Cc: Polytropon , "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:46:16 -0000 On Thu, Nov 05, 2009 at 09:26:15AM -0400, PJ typed: > 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? date "+%e" should do it. Ruben