I am attempting to filter an input file down to just the date and time and the subject. It was working fine until the input changed to a different format for some of the lines.
I was using the following:
I tried several different variations including:
to get it to print 3 lines below Subject if the subject does not contain the string "Server". I have been unsuccessful thus far.
Below is the sample input.
From: abc@def.com
Sent: Thursday, June 03, 2004 8:12 PM
To: def@abc.com
Subject: Job Failed
(Server: "INF05") Job "APPS26 - Diff" failed.
From: abc@def.com
Sent: Thursday, June 03, 2004 6:41 PM
To: def@abc.com
Subject: Backup Exec Alert: Job Failed (Server: "INF08") (Job: "INF22 - Full(Wkly)")
(Server: "INF08") (Job: "INF22 - Full(Wkly)") INF22 - Full(Wkly) -- The job failed with the following error: A communications failure has occurred between the Backup Exec job engine and the remote agent.
Below is the desired output.
Thursday, June 03, 2004 8:12 PM Job Failed (Server: "INF05") Job "APPS26 - Diff" failed.
Thursday, June 03, 2004 6:41 PM Backup Exec Alert: Job Failed (Server: "INF08") (Job: "INF22 - Full(Wkly)")
Any help would be greatly appreciated.
Thanks,
John
I was using the following:
Code:
/^Sent:/{$1=""; date = $0}
/^Subject:/{if ($0 ~ "Server")
$1=""
print date, $0
}
I tried several different variations including:
Code:
/^Sent:/{$1=""; date = $0}
/^Subject:/{if ($0 ~ "Server")
$1=""
print date, $0
else if ($0 !~ "Server"){msg = $2" "$3; next;next;print date, msg, $0}
}
to get it to print 3 lines below Subject if the subject does not contain the string "Server". I have been unsuccessful thus far.
Below is the sample input.
From: abc@def.com
Sent: Thursday, June 03, 2004 8:12 PM
To: def@abc.com
Subject: Job Failed
(Server: "INF05") Job "APPS26 - Diff" failed.
From: abc@def.com
Sent: Thursday, June 03, 2004 6:41 PM
To: def@abc.com
Subject: Backup Exec Alert: Job Failed (Server: "INF08") (Job: "INF22 - Full(Wkly)")
(Server: "INF08") (Job: "INF22 - Full(Wkly)") INF22 - Full(Wkly) -- The job failed with the following error: A communications failure has occurred between the Backup Exec job engine and the remote agent.
Below is the desired output.
Thursday, June 03, 2004 8:12 PM Job Failed (Server: "INF05") Job "APPS26 - Diff" failed.
Thursday, June 03, 2004 6:41 PM Backup Exec Alert: Job Failed (Server: "INF08") (Job: "INF22 - Full(Wkly)")
Any help would be greatly appreciated.
Thanks,
John