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