#! /usr/bin/gawk -f # Last edited on 2004-02-01 02:17:54 by stolfi BEGIN { n = 0; } /^[\#][ ][=][=][=]/ { fdate = $3; gsub(/[.]htm[l]?/, "", fdate); print; next; } /^[@]item{/ { n++; bdate = gensub(/^[@]item{.*}{(.*)}{.*}.*$/, "\\1", "s", $0); title = gensub(/^[@]item{.*}{.*}{(.*)}.*$/, "\\1", "s", $0); gsub(/[ ]/, "_", title); printf "# Broadcast date: %s\n", bdate; printf "@item{%d}{%s}{%s}\n", n, fdate, title; next; } // { print; next; }