#!/usr/bin/gawk -f
{
## some html escapes:
gsub(">",">")
gsub("<","<")
gsub(""","\"")
gsub("&","\\&")
## replace fancy "smart" quotes with straight equivalents
gsub("’","'")
gsub("‘","'")
gsub("“","\"")
gsub("”","\"")
## backquote to apostrophe
gsub("`","'")
## double quote to apostrophe
gsub("\"","'")
## select illegal filename characaters replaced by alternates (other illegal characters just dropped later)
gsub(">",")")
gsub("<","(")
gsub("[:]"," - ")
gsub("[/]","-")
## backslash to dash
gsub("\\\\","-")
## double space to single space:
gsub(" "," ")
## sanitize the rest:
gsub("[^- 'a-zA-Z0-9 _$+&={}\\[\\]()%@!;,.]*","")
## dump it to stdout
print
}