# generate the following log files: # * twtxt gemini # * twtxt web # * atom feed gemini # * atom feed web # * gmo log # * gmisub # to use: # awk -f genlog.awk log.txt BEGIN{ twgempath = "gem/tw.txt" twwebpath = "web/tw.txt" loggmopath = "src/log.gmo" atomwebpath = "web/atom.xml" atomgempath = "gem/atom.xml" gmisubpath = "gem/feed.gmi" loggmoheader = "log/logheader.gmi" gematomheader = "log/gematomheader.txt" webatomheader = "log/webatomheader.txt" gmisubheader = "log/feedheader.gmi" FS = "\t" "date +%F"| getline fecha system("cp " loggmoheader " " loggmopath) system("cp " gematomheader " " atomgempath) system("cp " webatomheader " " atomwebpath) system("cp " gmisubheader " " gmisubpath) updated = "" fecha "T12:00:00Z" print updated >> atomgempath print updated >> atomwebpath print "# nick = compudanzas" > twgempath print "# nick = compudanzas" > twwebpath } { # $1 es la fecha # $2 el texto # $3 el wikilink, opcional twgemstring = $1 "\t" $2 twwebstring = $1 "\t" $2 date = $1 gsub(/T.+$/,"",date) # remove time from date print "## " date >> loggmopath printf "%s\n", $2 >> loggmopath # web atom feed printf "\n\n" >> atomwebpath print "" $2 "" >> atomwebpath print "" $1 "" >> atomwebpath # gem atom feed printf "\n\n" >> atomgempath print "" $2 "" >> atomgempath print "" $1 "" >> atomgempath if ( match($3, /\{.+\}/) ){ # si hay wikilink gsub(/\{/,"",$3) gsub(/\}/,"",$3) filename = $3 gsub(" ","_",filename) print "=> ./" filename ".gmi {" $3 "}" >> loggmopath print "=> ./" filename ".gmi " date " " $2 >> gmisubpath gemurl = "gemini://compudanzas.net/" filename ".gmi" weburl = "https://compudanzas.net/" filename ".html" twgemstring = twgemstring " | " gemurl twwebstring = twwebstring " | " weburl print "" >> atomwebpath print "" weburl "#" date "" >> atomwebpath print "" >> atomgempath print "" gemurl "" >> atomgempath } else{ print "" >> atomwebpath print "https://compudanzas.net/log.html#" date "" >> atomwebpath print "" >> atomgempath print "gemini://compudanzas.net/log.gmi#" date "" >> atomgempath } print twgemstring > twgempath print twwebstring > twwebpath print "" >> atomwebpath print "" >> loggmopath } END { print "" >> atomwebpath }