#!/usr/bin/gawk -f #date "+'%b %Y' --date='yesterday'" #cmd="date +%Y%m%s";cmd | getline date;close(cmd) BEGIN {RS = "}";srand();} #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 +'%Y-%m-%d %H:%M:%S' --date=\047" date "\047" | getline rndate;close(cmd)} {gsub(/\n/,"",rndate)} {gsub(/\n/,"",date)} # 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 "l", length(contentLines), "r", randnum, "w", whichLine, "t", title} {printf "wp post create ./post_content.txt --path=/var/www/wordpress"} {printf " --post_title='" title "'"} {printf " --post_date='" rndate "'"} {printf " --post_status='publish'"}