#!/usr/local/bin/gawk -f # # notesab.awk - written by Kevin P. Inscoe # # Parses the output of exporting the Lotus Notes 4.51 # Personal Address Book as "Structured Text" into a # flat comma-delimited file for importing into Palm # utilities or other address book tools. # # History: # # When Who What # ---- --- ---- # 20-Mar-99 Kevin Inscoe Create Original # ############################################################### # # Global variables # BEGIN { ITO_app_grp = "wiz_app" ITO_os_grp = "OS" ITO_os_obj = "OpenVMS" ITO_app_obj = "wizard" ITO_os_appl = "OpenVMS" ITO_app_appl = "wizard" ITO_Command = "/opt/OV/bin/OpC/opcmsg " } # # match on first occurance of From: line and save in variable # /^To: / { if (!to) to = tolower($2) } # set the to line for the node # # match on first occurance of From: line and save in variable # /^From: / { if (!from) from = $2 } # set the from for replies # # match on first occurance of Subject: line and save in variable. # /^Subject: / { if (!subj) subj = $2 } # set the severity from the subject line # # match on ITO group text # /^ITOGRP\$\$:/ { ito_group = $0 ito_group = substr(ito_group, 11) } # # match on ITO message text # /^ITOTXT\$\$:/ { ito_text = $0 ito_text = substr(ito_text, 11) } # # match on Alpha message text # /^TEXT\$\$:/ { alpha_text = $0 alpha_text = substr(alpha_text, 9) } # # End of job # END { node = substr(to, 1, index(to, "@")-1) from = substr(from, 1, index(from, "@")-1) subj = substr(subj, 1) if (subj == "warn") { subj = "warning" } if (ito_group == ITO_app_grp) { app = ITO_app_appl obj = ITO_app_obj } else { app = ITO_os_appl obj = ITO_os_obj } command = ITO_Command "node=" "\042" node "\042" command = command " severity=" "\042" subj "\042" command = command " appl=" "\042" app "\042" command = command " obj=" "\042" obj "\042" command = command " msg_grp=" "\042" ito_group "\042" command = command " msg_text=" "\042" from ":" ito_text "\042" print command print "debug: {filter.awk } *******************************************" system(command) }