home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HTML - Publishing on the Internet
/
html_cdrom.iso
/
tools
/
html
/
linux
/
check
/
metachar.awk
< prev
next >
Wrap
Text File
|
1995-01-14
|
653b
|
18 lines
#metachar.awk: Trivial awk script to protect HTML/SGML "&<>" meta-characters.
#
# Typical use:
#
# awk -f htmlchek.awk infile.text > outfile.htmltext
#
# This program protects the HTML/SGML metacharacters `&', `<' and `>' by
# replacing them with the appropriate entity references; it is useful for
# importing plain text into an HTML file.
#
# On some systems, non-archaic awk may actually be named ``nawk''. The
# ``gawk'' interpreter freely-available from the FSF GNU project is more robust
# than some vendor-supplied awk/nawk interpreters.
#
/[><&]/{gsub(/&/,"\\&");gsub(/>/,"\\>");gsub(/</,"\\<")}
{print}
##EOF