awk syntax error?

awk syntax error?

Post by Kathy Mena » Sun, 06 Nov 1994 07:11:35



Can anyone tell the cause of the following error message: <local finger
"|/user/finger/mailfinger" 0>: awk: syntax error near line 2 [exit status
2] for the script excerpt that follows???

/usr/5bin/awk 'BEGIN{hdr=1}
hdr&&/[Ss][Uu][Bb][Jj][Ee][Cc][Tt]:/{target=substr($0,9)}
hdr&&/[Ff][Rr][Oo][Mm]:/{from=substr($0,6)}
hdr&&/[Rr][Ee][Pp][Ll][Yy]-[Tt][Oo]:/{reply2=substr($0,10)}
tl1&&(0==length(target)){target=$1;tl1=0}
/^$/{hdr=0;tl1++}
END{
  while (" "==substr(target,1,1))
    target = substr(target,2)
  while (" "==substr(target,length(target),1))
    target = substr(target,1,length(target)-1)
  if (0==length(reply2))
    reply2=from
  if (0==length(reply2))
    exit
  system("( echo \"From: '"$LOCADDR"'\nTo: " reply2 "\n"\
    "Subject: Information about " target " enclosed\n"\
    "\" ; '"$FINGER"' " target " ) | '"$SENDMAIL"' -ba -i -t");
  system("echo '"`date \"+%D %T\"`"' \\\""\
    target "\\\" fingered by \" " reply2 "\" >>'"$LOGFILE"'");

Quote:}'