From owner-freebsd-questions@FreeBSD.ORG Sun Nov 8 20:05:43 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 3EE1A1065670 for ; Sun, 8 Nov 2009 20:05:43 +0000 (UTC) (envelope-from walt@wump.org) Received: from mta11.charter.net (mta11.charter.net [216.33.127.80]) by mx1.freebsd.org (Postfix) with ESMTP id E1B7E8FC24 for ; Sun, 8 Nov 2009 20:05:42 +0000 (UTC) Received: from imp10 ([10.20.200.10]) by mta11.charter.net (InterMail vM.7.09.02.04 201-2219-117-106-20090629) with ESMTP id <20091108200542.IKNG8038.mta11.charter.net@imp10>; Sun, 8 Nov 2009 15:05:42 -0500 Received: from [10.0.0.10] ([68.116.98.9]) by imp10 with smtp.charter.net id 2k5f1d00B0C8vLc05k5gX2; Sun, 08 Nov 2009 15:05:42 -0500 X-Authority-Analysis: v=1.0 c=1 a=ebNzH6DdAAAA:8 a=Mo3bIQVSAKC-G1owKasA:9 a=l4Jhg5i-1FSRTBquFAIA:7 a=OxcjeVIenc1gpt79UCaor32FH9oA:4 a=Z-IikAJXHoYA:10 a=zbkDLoAsQ4cA:10 Mime-Version: 1.0 Message-Id: In-Reply-To: <4AF2E413.2080907@videotron.ca> References: <4AF1FF76.60808@videotron.ca> <20091105023045.9a3d90ab.freebsd@edvax.de> <4AF2D277.3090406@videotron.ca> <20091105144609.GA28950@ei.bzerk.org> <4AF2E413.2080907@videotron.ca> Date: Sun, 8 Nov 2009 12:05:34 -0800 To: PJ , Ruben de Groot , Polytropon , "freebsd-questions@freebsd.org" From: Walt Pawley Content-Type: text/plain; charset="us-ascii" Cc: 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: Sun, 08 Nov 2009 20:05:43 -0000 At 10:41 AM -0400 11/5/09, PJ wrote: >Ruben de Groot wrote: >> 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. >> >Sure did.... For the moment, I changed the [ ] to just plain > >maybe that will avoid the disjointed row. Not quite what you're looking for but ... cal | perl -pe 's/^/ /;s/$/ /;s/ '"$(date "+%e")"' /\['"$(date "+%e")"']/' ... generated ... November 2009 S M Tu W Th F S 1 2 3 4 5 6 7 [ 8] 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -- Walter M. Pawley Wump Research & Company 676 River Bend Road, Roseburg, OR 97471 541-672-8975