conky calendar

2009-10-10 Thread PJ
I'm having a bit of a time with the calendar.sh script I found on the
Net; it doesn't display quite correctly.
It should have brackets around the current date, but I can't figure out
what is not functioning correctly:

#!/bin/sh
cal | awk 'NR2' | sed -e 's/   //g' -e 's/[^ ] / /g' -e 's/..*/  
/' -e 's/ \('`date | awk '{print $2}'`'\) /\['`date | awk '{print $2}'`'\]/'

Change the NR2 to NR1 and the printout includes the days of the week:
  Su  Mo  Tu  We  Th  Fr  Sa
   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  31

Since today is the 10th, we should be seeing [10] - but we are not.
Also, there is the problem of the 1,2,3 not showing in the right days -
in conky this can be fixed by not using xft... but then I'm not sure of
how to change the font size... perhaps the xorg screen size is the
default ???

I'm not very good at programming, but I did look up the man pages for
cal, sed and awk but it is a little complicated for my little brain.
Can anyone help, please?
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: conky calendar

2009-10-10 Thread jhell


On Sat, 10 Oct 2009 05:01, af.gourmet@ wrote:

I'm having a bit of a time with the calendar.sh script I found on the
Net; it doesn't display quite correctly.
It should have brackets around the current date, but I can't figure out
what is not functioning correctly:

#!/bin/sh
cal | awk 'NR2' | sed -e 's/   //g' -e 's/[^ ] / /g' -e 's/..*/  
/' -e 's/ \('`date | awk '{print $2}'`'\) /\['`date | awk '{print $2}'`'\]/'

Change the NR2 to NR1 and the printout includes the days of the week:
 Su  Mo  Tu  We  Th  Fr  Sa
  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  31

Since today is the 10th, we should be seeing [10] - but we are not.
Also, there is the problem of the 1,2,3 not showing in the right days -
in conky this can be fixed by not using xft... but then I'm not sure of
how to change the font size... perhaps the xorg screen size is the
default ???

I'm not very good at programming, but I did look up the man pages for
cal, sed and awk but it is a little complicated for my little brain.
Can anyone help, please?



Where did you Saturday go to ? I would love for some of my Thursdays and 
sometimes Fridays to just disappear like this but Saturday ? come on now 
what is the world coming to ? ;)


--

 ;; dataix.net!jhell 2048R/89D8547E 2009-09-30
 ;; BSD since FreeBSD 4.2Linux since Slackware 2.1
 ;; 85EF E26B 07BB 3777 76BE  B12A 9057 8789 89D8 547E

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: conky calendar

2009-10-10 Thread Roland Smith
On Sat, Oct 10, 2009 at 05:01:34AM -0400, PJ wrote:
 I'm having a bit of a time with the calendar.sh script I found on the
 Net; it doesn't display quite correctly.
 It should have brackets around the current date, but I can't figure out
 what is not functioning correctly:
 
 #!/bin/sh
 cal | awk 'NR2' | sed -e 's/   //g' -e 's/[^ ] / /g' -e 's/..*/  
 /' -e 's/ \('`date | awk '{print $2}'`'\) /\['`date | awk '{print $2}'`'\]/'

Look at the output of the date command:
Sat Oct 10 15:12:39 CEST 2009

Change 'print $2' to 'print $3' to get the numercal date.
Or even simpler: use date +%d instead of date | awk '{print $3}'.

Roland
-- 
R.F.Smith   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)


pgp3BcgoKyz5L.pgp
Description: PGP signature


Re: conky calendar

2009-10-10 Thread Richard Mahlerwein
From: Roland Smith rsm...@xs4all.nl
Subject: Re: conky calendar
To: PJ af.gour...@videotron.ca
Cc: freebsd-questions@freebsd.org
Date: Saturday, October 10, 2009, 9:27 AM

On Sat, Oct 10, 2009 at 05:01:34AM -0400, PJ wrote:
 I'm having a bit of a time with the calendar.sh script I 
 found on the Net; it doesn't display quite correctly.
 It should have brackets around the current date, but I 
 can't figure out what is not functioning correctly:
 
 #!/bin/sh
 cal | awk 'NR2' | sed -e 's/   /    /g' -e 's/[^ ] / /g' -e 's/..*/   /' 
 -e 's/ \('`date | awk '{print $2}'`'\) /\['`date | awk '{print $2}'`'\]/'

Look at the output of the date command:
Sat Oct 10 15:12:39 CEST 2009

Change 'print $2' to 'print $3' to get the numercal date.
Or even simpler: use date +%d instead of date | awk '{print $3}'.

Roland

I could not get it to work until I changed the single quotes in the last -e 
expression to double quotes.  (This either interactively under csh or as a 
script under sh).  BTW, using `date +%s` and with an additional minor change to 
make the numbers continue to line up ... Oh!  This will not fix mis-alignments 
on days when it is not the end of the week, I don't think ... anyway.

cal | awk 'NR1' | sed -e 's/   //g' -e 's/[^ ] / /g' -e 's/..*/  /' -e 
s/\ `date +%d`/\[`date +%d`\]/

Gives
$ sh newcal.sh
  Su  Mo  Tu  We  Th  Fr  Sa
   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  31

Now, if you had a space character at the end of each line, you could do 
something like ...

cal | awk 'NR1' | sed -e 's/   //g' -e 's/[^ ] / /g' -e 's/..*/  /' -e 
s/\ `date +%d`\ /\[`date +%d`\]/

And then it would replace (underscore is space) _8_ with [8] so it would 
always line up.  You can't do that without the space at the end of the line 
because the trailing numbers look like this _17 not _17_.  But, fix that, 
and you can use the above.  That is left as an exercise for the reader.  

-Rich


 
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: conky calendar

2009-10-10 Thread Karl Vogel
You can use the terminal standout codes to highlight today's date, but you
need either the Linux compatibility stuff or a recent version of ncurses
installed:

  #!/bin/ksh
  PATH=/usr/compat/linux/usr/bin:/usr/local/bin:/bin:/usr/bin
  export PATH

  DAY=$(date +%d | sed 's/0\([123456789]\)/ \1/')
  SMSO=$(tput smso)
  RMSO=$(tput rmso)
  cal | sed -e 's/^/ /' -e 3,\$s/ ${DAY}/ ${SMSO}${DAY}${RMSO}/
  exit 0

-- 
Karl Vogel  I don't speak for the USAF or my company

Letterman's top signs your cat is trying to kill you #9:
 To tune of Meow Mix song sings, Kill kill kill kill, kill kill kill kill
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org