12-29-2005
check the status and send an email with status
Hi,
We have a text file which has the following data.
ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183
7~U~00200~000011258~0~P~<
GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002
ST~997~0001
AK1~SH~247
AK2~856~2470001
AK5~A
AK2~856~2470002
AK5~A
AK9~A~2~2~2
SE~8~0001
GE~1~000011258
IEA~00001~000011258
ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051227~191
3~U~00200~000011467~0~P~<
GS~FA~AF52M~U1CAD~051227~1913~000011467~X~002002
ST~997~0001
AK1~SH~53
AK2~856~530001
AK5~A
AK9~A~1~1~1
SE~6~0001
The data I am looking for is in the first line that starts with ISA and the third column data is “~ZZ~F159B” and “~ZZ~VISTN”.
On the basis of the above mentioned segments, I have to assign them status either as pass or fail, which has been accomplished by the code snippet provided by Vgersh99 and Rancha.
grep "~ZZ~" <data file> | nawk '{ print ($3=="~ZZ~VISTN") ? "passed":"failed" }'
Now the new requirement is that I have to send an email, which should have the status in the body of the email. Can this be achieved in one script or I have to write two scripts like one has the static body of the email and it just expects two arguments.
Template for static email:
Please be advised that the EDI ASN has been “status” (either passed or failed).
Hope this is not too confusing.
Regards,
Inder
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I believe i have most of samba configured right but i get this error each time time try to run it. I was given suggestion that i touch the file, i did, but i still cannot rid myself of this error.
Any suggestions (2 Replies)
Discussion started by: macdonto
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I have a datafile which has the following data and it can have much more records. The data set is as follows:
ISA~00~ ~00~ ~ZZ~F159B ~ZZ~U1CAD ~051215~184
3~U~00200~000011432~0~P~<
GS~FA~TC11A~U1CAD~051215~1843~000011432~X~002002
ST~997~0001... (6 Replies)
Discussion started by: isingh786
6 Replies
3. Red Hat
I have successfully installed RedHat 8.0 onto a Dell PowerEdge SC1425 today. This server has two SATA hard drives, and an IDE DVD-ROM drive.
Using the following kernel parameters, i successfully installed across both hard drives from CD:
ide0=0x1f0,0x3f6,14 vga=791 resolution=1024x768 expert... (5 Replies)
Discussion started by: fishsponge
5 Replies
4. UNIX for Dummies Questions & Answers
rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh`
if $rshstatus <>0 then
errstatus=1
mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr
else if errstatus=0
echo "status to xirsol8dr successful"
can anyone provide if this is t he correct way to do this or is there a better way? (1 Reply)
Discussion started by: bpm12
1 Replies
5. Shell Programming and Scripting
I have written a bash script to to sort the data from logs i need some help in printing the outputs , i dont have much ideas in bah scripting.
Sample script
-----------------------
#!/bin/bash
a=`date | cut -d " " -f2,2,3`
cat /var/log/maillog |grep "$a" |grep -E -e 'deferred|bounced'... (9 Replies)
Discussion started by: unimaxlin
9 Replies
6. Shell Programming and Scripting
I have some server ( IBM , Dell ) , our data center is not in the same location with office , therefore , I do not know if the HD lamp is flash when the HD is fault , can advise if I can write a script to check if the HD is normal running or not ?
thanks (1 Reply)
Discussion started by: ust
1 Replies
7. Shell Programming and Scripting
Hi,
I have few processes in the server continuous run few jobs, each of the process will generate a log file which detailing when its jobs are completed.
the logfile will has the name something like this, result1.log, result2.log, result3.log,.... result10.log, result11.log, result12.log.......... (8 Replies)
Discussion started by: khchong
8 Replies
8. Shell Programming and Scripting
autorep -m bogus
Machine Name Max Load Current Load Factor O/S Status
___________ ________ ___________ ______ ________ ______
bogus --- --- 1.00 Sys Agent Online
Status
______
Online
Offline
Missing
Unqualified
The "Status" always "Online". I like create a script execute run... (6 Replies)
Discussion started by: dotran
6 Replies
9. Shell Programming and Scripting
Hi Guys,
Is there any way I can write a script that sends DISK SPACE USAGE STATUS via email once a week?
Thanks, (5 Replies)
Discussion started by: g4v1n
5 Replies
10. Programming
Dear Team
I am using DB2 v10 z/os database . Need expert guidance to figure out best way to track table activities ( Ex Delete, Insert,Update )
Scenario
We have a table which is critical and many developer/testing team access on daily basis . We had instance where some deleted... (1 Reply)
Discussion started by: Perlbaby
1 Replies
LEARN ABOUT DEBIAN
amc-mailing
AMC-MAILING(1) Auto Multiple Choice AMC-MAILING(1)
NAME
AMC-mailing - mail PDF annotated completed answer sheets to students
SYNOPSIS
auto-multiple-choice mailing [--xmlargs args.xml] --projet project-dir --students-list students-list.csv [--list-encoding encoding]
--email-column col --sender sender-email --subject subject --text email-body [--debug file.log]
[transport arguments...]
DESCRIPTION
The command AMC-mailing.pl sends by email the PDF annotated completed answer sheets to the students. Email addresses are taken from the
students list file.
--projet project-dir
Gives the project directory.
--students-list students-list.csv
sets the students list file name.
--list-encoding encoding
selects an encoding for file students-list.csv (default is utf-8).
--email-column col
sets the name of the column containing the email addresses of the students in the students list file.
--sender sender-email
sets the sender email.
--subject subject
sets the subject of the emails to send.
--text email-body
sets the body text of the emails to send.
--transport transport
sets the transport to use. transport may be sendmail or SMTP.
--debug file.log
gives a file to fill with debugging information.
TRANSPORT ARGUMENTS
Depending on the value used for argument transport, the following arguments can be added:
Transport sendmail
--sendmail-path path
sets the path to the sendmail command (defaults to /usr/sbin/sendmail).
Transport SMTP
--smtp-host host
sets the SMTP hostname (defaults to smtp).
--smtp-port port
sets the port to use (default value is 25).
ARGUMENTS IN A XML FILE
To avoid encoding problems, one can place some arguments in a XML file and use the --xmlargs file.xml argument as the first command
argument. Here is an exemple of such a file:
<?xml version="1.0" encoding="UTF-8"?>
<arguments>
<arg>--sender</arg><arg>Bienvenue <paamc@passoire.fr></arg>
<arg>--text</arg><arg>Voila votre copie corrigee</arg>
<arg>--subject</arg><arg>QCM</arg>
</arguments>
AUTHORS
Alexis Bienvenue <paamc@passoire.fr>
Main author
Jean Berard
Translation from French
Georges Khaznadar
Translation from French
COPYRIGHT
Copyright (C) 2008-2012 Alexis Bienvenue
This document can be used according to the terms of the GNU General Public License, version 2 or later.
Auto Multiple Choice 1.1.1 06/19/2012 AMC-MAILING(1)