I'm trying to parse the data from text files. The sample data on the text file is as below,
REPT NO.XXXXX PAGE 1
BANK NO. XXX MAINTENANCE REJECT REPORT
DATE 02/14/23
Y (IF CHANGED)
************************************************************************************************************************************
Account 001-0002-003-0004-0005
NAME 1 : Test,1
NAME 2 :
Y ADDRESS 1 : Address for Test 1 ADDRESS REJECTED
ADDRESS 2 :
Y CITY-STATE : Unknown, OH ADDRESS REJECTED
Y ZIP : 43230 ADDRESS REJECTED
HOME PHONE : 000-008-7666
OTHER PHONE : 000-000-0000
BUSINESS PHONE: 000-000-0000 EXT.
************************************************************************************************************************************
Account 121-0000-006-5785-6560
NAME 1 : Test,2
NAME 2 :
Y ADDRESS 1 : Address for Test 2 ADDRESS REJECTED
ADDRESS 2 :
Y CITY-STATE : Test, PUERTO RICO ADDRESS REJECTED
Y ZIP : 00729 ADDRESS REJECTED
HOME PHONE : 000-000-0000
OTHER PHONE : 000-000-0000
BUSINESS PHONE: 000-000-0000 EXT.
BUSINESS NAME :
Data for multiple accounts is split by using asterisk(******) in the line
The requirement is to extract the account number. If line item starts with Y then extract the details on it. For e:g Y ADDRESS 1 : Address for Test 1 ADDRESS REJECTED then ADDRESS 1 = Address for Test 1 ADDRESS REJECTED