Hi,
Its been a long time since I have used Bash to write a script so am really struggling here. Need the gurus to help me out.
uname -a
Linux lxserv01 2.6.18-417.el5
i have a text file with blocks of code written in a similar manner
******* BEGIN MESSAGE *******
Station / User: 129 800013 Batch Processing
SDate / Time / PDate: 26.02.2017 17:07:05 26.02.2017
Current System: XXXXXX Production System
Institution Number: 00000043
Application / Version: abc-inw 30.66.36 Release A (OMNI)
Function Name: FindOriginalPresentment
Warning !
Original presentment Not Found !
Institution No (Original Tran): [00000043]
Charge back slip: [70527509216]
Acquirer Reference: [85470355344549150697093]
Presentment Slip: [N/A]
Transaction Class: [002 - Clearing transactions]
Transaction Category: [001 - Presentments]
File Institution No: [00000043]
File No: [00041926]
******* END MESSAGE *******
******* BEGIN MESSAGE *******
Station / User: 129 800013 Batch Processing
SDate / Time / PDate: 26.02.2017 17:06:59 26.02.2017
Current System: XXXXXX Production System
Institution Number: 00000043
Application / Version: abc-inw 30.66.36 Release A (OMNI)
Information message !
Exception Processing - Sundry Types!
Date: [20170226]
Time: [17:06:59]
003','040
******* END MESSAGE *******
******* BEGIN MESSAGE *******
Station / User: 129 800013 Batch Processing
SDate / Time / PDate: 26.02.2017 17:07:05 26.02.2017
Current System: XXXXXX Production System
Institution Number: 00000043
Application / Version: abc-inw 30.66.36 Release A (OMNI)
Function Name: FindOriginalPresentment
Warning !
Original presentment Not Found !
Institution No (Original Tran): [00000043]
Charge back slip: [70527509216]
Acquirer Reference: [85470355344549150697093]
Presentment Slip: [N/A]
Transaction Class: [002 - Clearing transactions]
Transaction Category: [001 - Presentments]
File Institution No: [00000043]
File No: [00041926]
******* END MESSAGE *******
******* BEGIN MESSAGE *******
Station / User: 129 800013 Batch Processing
SDate / Time / PDate: 26.02.2017 17:06:59 26.02.2017
Current System: XXXXXX Production System
Institution Number: 00000043
Application / Version: abc-inw 30.66.36 Release A (OMNI)
Information message !
Exception Processing - Sundry Types!
Date: [20170226]
Time: [17:06:59]
003','040
******* END MESSAGE *******
Each 'BEGIN MESSAGE' and the subsequent 'END MESSAGE' is a block. Once in this block, if there is a pattern/text 'Original presentment Not Found !', the script should spit out the entire BEGIN and END block. I started with a simple command to search for BEGIN and END blocks but the bash script is giving me errors on finding the GLOB in the BEGIN/END pattern of a block.
Help please, I am lost here.
Thanks a lot.