I get this error message awka: 1: unexpected character '.' I've built awka-0.7.5 under HP-UX 11.o using gcc 2.95.2
Does any ne have an idea of what the problem may be?
Gerry Ginsburg William M. Mercer 540 Lake Cook Rd 60015 gerry.ginsburg@us.wmmercer.com
The script is
BEGIN { lines = 0; controller = 0; leader = 0; web_server = ENVIRON["WEB_SERVER"]; if (!web_server) web_server = "wmmercer.com"; web_path = ENVIRON["WEB_PATH"]; if (!web_path) web_path = "internal/billmemos"; html_font = ENVIRON["HTML_FONT"]; if (!html_font) html_font = "<font color=\"#777777\" face=\"Verdana\" size=\"2\">"; data_path = ENVIRON["DATA_PATH"]; if (!data_path) data_path = "files/"; if (substr(data_path,length(data_path)) != "/") data_path = data_path "/"; if (system("test -d " data_path)) system("mkdir " data_path); html_path = ENVIRON["HTML_PATH"]; if (!html_path) html_path = "emails/"; if (substr(html_path,length(html_path)) != "/") html_path = html_path "/"; if (system("test -d " html_path)) system("mkdir " html_path); data_ext = ENVIRON["DATA_EXT"]; if (!data_ext) data_ext = ".txt"; html_ext = ENVIRON["HTML_EXT"]; if (!html_ext) html_ext = ".htm"; } { gsub("\r",""); s = split($0,a,"\f"); #line[lines++] = a[1] (s>1?"\f":"\n"); line[lines++] = a[1] "\n"; if ($1 ~ /Client:/) { client = gsub("/","_",$2); client_line = $0; } if ($1 ~ /Engagement:/) { engagement = gsub("/","_",$2); engagement_line = $0; } if ($1 ~ /Project:/) { project = gsub("/","_",$2); project_line = $0; } if (controller) { controller_email = $1; controller = 0; } if (leader) { leader_email = $1; leader = 0; } if ($0 ~ /Billing Supporter:/) { leader_email = ""; } if ($0 ~ /Billing Consultant:/) { controller = 1; } if ($0 ~ /Lead Consultant:/) { leader = 1; } } /\f/ { redirect_page(); } END { redirect_page(); } function redirect_page() { split(controller_email,_controller,"@"); a_controller = _controller[1]; split(leader_email,_leader,"@"); a_leader = _leader[1]; for ( i = 0; i < lines; ++i ) { if (controller_email) { datafile = data_path client "_" engagement "_" memo "_" a_controller data_ext; if (!created[datafile]) { printf "" > datafile; created[datafile] = 1; } printf "%s", line[i] >> datafile; } close(datafile) if (leader_email) { datafile = data_path client "_" engagement "_" project "_" memo "_" a_leader data_ext; if (!created[datafile]) { printf "" > datafile; created[datafile] = 1; } printf "%s", line[i] >> datafile; } } close(datafile) if (controller_email) { datafile = client "_" engagement "_" memo "_" a_controller data_ext; if (!linked[datafile]) { #email = html_path a_controller html_ext; email = html_path controller_email; if (!created[email]) { printf "" > email; created[email] = 1; } printf "%s\n%s\n%s\n", memo_line, client_line, engagement_line >> email; printf "Find details at http://%s/%s%s\n\n", web_server, web_path, datafile >> email; linked[datafile] = 1; } } if (leader_email) { datafile = client "_" engagement "_" project "_" memo "_" a_leader data_ext; if (!linked[datafile]) { #email = html_path a_leader html_ext; email = html_path leader_email; if (!created[email]) { printf "" > email; created[email] = 1; } printf "%s\n%s\n%s\n%s\n", memo_line, client_line, engagement_line, project_line >> email; printf "Find details at http://%s/%s%s\n\n", web_server, web_path, datafile >> email; linked[datafile] = 1; } } line[0] = a[2] "\n"; lines = 1; if (a[2] ~ /Bill Memo Number/) { split(a[2],b); memo = b[4]; memo_line = "Bill Memo No: " b[4]; } if (a[2] ~ /Work Rel. Memo No/) { split(a[2],b); memo = b[5]; memo_line = "Work Rel. Memo No: " b[5]; } }
Did you remember to use the -f flag before the input filename? It works for me when I remember to do that.
Log in to post a comment.
I get this error message
awka: 1: unexpected character '.'
I've built awka-0.7.5 under HP-UX 11.o using gcc 2.95.2
Does any ne have an idea of what the problem may be?
Gerry Ginsburg
William M. Mercer
540 Lake Cook Rd 60015
gerry.ginsburg@us.wmmercer.com
The script is
BEGIN {
lines = 0; controller = 0; leader = 0;
web_server = ENVIRON["WEB_SERVER"];
if (!web_server) web_server = "wmmercer.com";
web_path = ENVIRON["WEB_PATH"];
if (!web_path) web_path = "internal/billmemos";
html_font = ENVIRON["HTML_FONT"];
if (!html_font)
html_font = "<font color=\"#777777\" face=\"Verdana\" size=\"2\">";
data_path = ENVIRON["DATA_PATH"];
if (!data_path) data_path = "files/";
if (substr(data_path,length(data_path)) != "/")
data_path = data_path "/";
if (system("test -d " data_path))
system("mkdir " data_path);
html_path = ENVIRON["HTML_PATH"];
if (!html_path) html_path = "emails/";
if (substr(html_path,length(html_path)) != "/")
html_path = html_path "/";
if (system("test -d " html_path))
system("mkdir " html_path);
data_ext = ENVIRON["DATA_EXT"];
if (!data_ext) data_ext = ".txt";
html_ext = ENVIRON["HTML_EXT"];
if (!html_ext) html_ext = ".htm";
}
{
gsub("\r","");
s = split($0,a,"\f");
#line[lines++] = a[1] (s>1?"\f":"\n");
line[lines++] = a[1] "\n";
if ($1 ~ /Client:/) { client = gsub("/","_",$2); client_line = $0; }
if ($1 ~ /Engagement:/) { engagement = gsub("/","_",$2); engagement_line = $0; }
if ($1 ~ /Project:/) { project = gsub("/","_",$2); project_line = $0; }
if (controller) { controller_email = $1; controller = 0; }
if (leader) { leader_email = $1; leader = 0; }
if ($0 ~ /Billing Supporter:/) { leader_email = ""; }
if ($0 ~ /Billing Consultant:/) { controller = 1; }
if ($0 ~ /Lead Consultant:/) { leader = 1; }
}
/\f/ { redirect_page(); }
END { redirect_page(); }
function redirect_page()
{
split(controller_email,_controller,"@");
a_controller = _controller[1];
split(leader_email,_leader,"@");
a_leader = _leader[1];
for ( i = 0; i < lines; ++i ) {
if (controller_email) {
datafile = data_path client "_" engagement "_" memo "_" a_controller data_ext;
if (!created[datafile]) {
printf "" > datafile;
created[datafile] = 1;
}
printf "%s", line[i] >> datafile;
}
close(datafile)
if (leader_email) {
datafile = data_path client "_" engagement "_" project "_" memo "_" a_leader data_ext;
if (!created[datafile]) {
printf "" > datafile;
created[datafile] = 1;
}
printf "%s", line[i] >> datafile;
}
}
close(datafile)
if (controller_email) {
datafile = client "_" engagement "_" memo "_" a_controller data_ext;
if (!linked[datafile]) {
#email = html_path a_controller html_ext;
email = html_path controller_email;
if (!created[email]) {
printf "" > email;
created[email] = 1;
}
printf "%s\n%s\n%s\n",
memo_line,
client_line,
engagement_line >> email;
printf "Find details at http://%s/%s%s\n\n",
web_server,
web_path,
datafile >> email;
linked[datafile] = 1;
}
}
if (leader_email) {
datafile = client "_" engagement "_" project "_" memo "_" a_leader data_ext;
if (!linked[datafile]) {
#email = html_path a_leader html_ext;
email = html_path leader_email;
if (!created[email]) {
printf "" > email;
created[email] = 1;
}
printf "%s\n%s\n%s\n%s\n",
memo_line,
client_line,
engagement_line,
project_line >> email;
printf "Find details at http://%s/%s%s\n\n",
web_server,
web_path,
datafile >> email;
linked[datafile] = 1;
}
}
line[0] = a[2] "\n";
lines = 1;
if (a[2] ~ /Bill Memo Number/) {
split(a[2],b);
memo = b[4]; memo_line = "Bill Memo No: " b[4];
}
if (a[2] ~ /Work Rel. Memo No/) {
split(a[2],b);
memo = b[5]; memo_line = "Work Rel. Memo No: " b[5];
}
}
Did you remember to use the -f flag before the input filename? It works for me when I remember to do that.
Last edit: Ben Veal 2017-02-12