function escape_html(text) { gsub(/&/, "\\&", text) gsub(//, "\\>", text) gsub(/"/, "\\"", text) return text } BEGIN { self = base name print "" print "" print " " title "" #print " " print " " print " " strftime("%FT%TZ") "" print " " self "" } FNR == 1 { if (NR != 1) { end_entry() } id = base FILENAME datecmd = "date -Isec -r " FILENAME datecmd | getline time close(datecmd) print "" print " " FILENAME "" print " " id "" print " " print " " author_name "" author_email "" print " " time "" printf " <pre>" } { print escape_html(escape_html($0)) } function end_entry() { print "</pre>" print "" } END { end_entry() print "" }