#!/usr/bin/gawk -f
#date "+'%b %Y' --date='yesterday'"
#cmd="date +%Y%m%s";cmd | getline date;close(cmd)
BEGIN {RS = "}"; srand(3);}
#first="$1"
#cmd="date -R --date=$first";cmd | getline date;close(cmd)
#cat changelog.txt| gawk -v date="$DATE" -e 'BEGIN {RS = "|"} $0 ~ date'
## gawk ' BEGIN {RS = "\n" ; ORS = "
"} { print $0 } '
#echo "]]>"
#echo ""
{date=$1 " " $2 " " $3}
{cmd="date -R --date=\047" date "\047" | getline rndate;close(cmd)}
# make random line the title
{split($0, contentLines, "\n")}
{randnum=(rand()*(length(contentLines)-2))+2}
{split(randnum,lineFloat,".")}
{whichLine=lineFloat[1]}
{title=contentLines[whichLine]}
{print "- "}
{print "lang"}
{print "" title ""}
{printf "" rndate }
{print ""}
{printf ""}
{print "
"}