home *** CD-ROM | disk | FTP | other *** search
/ HTML - Publishing on the Internet / html_cdrom.iso / tools / html / linux / check / metachar.awk < prev    next >
Text File  |  1995-01-14  |  653b  |  18 lines

  1. #metachar.awk: Trivial awk script to protect HTML/SGML "&<>" meta-characters.
  2. #
  3. # Typical use:
  4. #
  5. #   awk -f htmlchek.awk infile.text > outfile.htmltext
  6. #
  7. #   This program protects the HTML/SGML metacharacters `&', `<' and `>' by
  8. # replacing them with the appropriate entity references; it is useful for
  9. # importing plain text into an HTML file.
  10. #
  11. #    On some systems, non-archaic awk may actually be named ``nawk''.  The
  12. # ``gawk'' interpreter freely-available from the FSF GNU project is more robust
  13. # than some vendor-supplied awk/nawk interpreters.
  14. #
  15. /[><&]/{gsub(/&/,"\\&");gsub(/>/,"\\>");gsub(/</,"\\<")}
  16. {print}
  17. ##EOF
  18.