Because version 1.8 will introduce options for hdate to display more astronomical times of day (zmanim), the output for a non-holiday may exceed 15 lines.
$ ./hdate -tttq --data-first --daf-yomi
Thursday, 3 January 2013, 21 Tevet 5773
05:52 first_light
06:21 talit
07:20 sunrise
08:41 end_Shema_(M"A)
09:39 end_Shema_(GR"A)
10:26 end_amidah
11:59 midday
12:29 mincha_gedola
14:42 mincha_ketana
15:41 plag_hamincha
16:39 sunset
17:10 first_stars
17:25 three_stars
00:46:37 sun_hour
daf_yomi: Shabbat 92
Personally, I dislike wasting screen space and having data needlessly scrolling off the page, so I'm considering options to format the output in two or three columns, sequenced vertically, to yield output like this:
$ ./hdate -tttq --data-first --daf -2
Thursday, 3 January 2013, 21 Tevet 5773
05:52 first_light 14:42 mincha_ketana
06:21 talit 15:41 plag_hamincha
07:20 sunrise 16:39 sunset
08:41 end_Shema_(M"A) 17:10 first_stars
09:39 end_Shema_(GR"A) 17:25 three_stars
10:26 end_amidah 00:46:37 sun_hour
11:59 midday daf yomi: Shabbat 92
12:29 mincha_gedola
$ ./hdate -tttq --data-first --daf -3
Thursday, 3 January 2013, 21 Tevet 5773
05:52 first_light 10:26 end_amidah 16:39 sunset
06:21 talit 11:59 midday 17:10 first_stars
07:20 sunrise 12:29 mincha_gedola 17:25 three_stars
08:41 end_Shema_(M"A) 14:42 mincha_ketana 00:46:37 sun_hour
09:39 end_Shema_(GR"A) 15:41 plag_hamincha daf_yomi: Shabbat
I haven't yet made the decision to include these options; the above were generated by awk one-liners I wrote in order to quickly toy with the results I would like.
This is the awk invocation to display the first line colorized (in green) and the remaining lines in two equal length columns:
/hdate -tttq --data-first --daf | \
awk -F "\n" -v RS="" '{printf "\033[1;32m%s\033[0m\n", $1; rows = int((NF-1)/2) + (NF-1)%2 ; for(a=1;a<=rows;a++) printf "%-22s %-20s\n", $(a+1), $(a+1+rows) }'
For those of you unfamiliar with awk, -F "\n"
tells awk to treat a newline character as a field separator, and -v RS=""
tells awk not to use any character as a record separator (the default is a newline character). Thus, the hdate output of 15 lines will be read by awk as a single record of 15 fields. The first statement prints the first line/field, then the number of rows is calculated using awk's internal variable NF
(number of fields), and finally awk loops through the rows to print the remaining fields.
This is the awk invocation to display the first line colorized (in green) and the remaining lines in three equal length columns, with data and labels also colorized (in yellow and blue):
/hdate -tttq --data-first --daf | \
( YELLOW="\033[1;33m"; BLUE="\033[1;34m"; \
awk -F "\n" -v RS="" -v VALUE="$YELLOW" -v LABEL="$BLUE" -v RESET="\033[0m" '{printf "\033[1;32m%s\033[0m\n", $1; $1=""; FS=" "; $0=$0; rows = int(NF/6+.5) ; for(a=1;a<=(rows*2);a+=2) printf "%s%-5s%s %s%-16s%s %s%-5s%s %s%-15s%s %s%-5s%s %s%-15s%s\n", VALUE, $(a), RESET, LABEL, $(a+1), RESET, VALUE, $(a+rows*2), RESET, LABEL, $(a+rows*2+1), RESET, VALUE, $(a+rows*4), RESET, LABEL, $(a+rows*4+1), RESET }' )
This one-liner differs from the above in that: The first field is deleted after being printed ($1=""
); The field-separator is redefined (FS=" "
); And awk is forced to re-evaluate the current record ($0=$0
), thus reassigning values to fields and recalculating the number of fields according to the new field separator value.