E=mc2
asked on
How can I use a Powershell script to output data for an Invoice
Input Data, in a file called Source.txt
ISA*00* *00* *12*1234567891 *ZZ*COMPANYCOL *213456*1234*A*00123*12300 0010*1*P*> ~
GS*IN*2134567891*123456789 1*20141024 *1234*00*X *001234~
ST*999*1234561~
BIG*20141020*123456.*20140 917*123456 7.~
N1*RI*COMPANY*0*000000000~
N1*BT*COMPANY 2*0*12345678910000~
ITD*00*2*****00~
DTM*000*20141020~
FOB*CC~
IT1*1*200*CA*5.4**UN*12345 6789123*VN *01234A~
IT1*2*50*CA*1.4**UN*213456 789122*VN* 02345A~
IT1*3*60*CA*12.4**UN*78945 6123123*VN *06789A~
TDS*1234567~
ISS*1234*CA*12345*LB~
SE*12*123456~
GE*1*10~
IEA*1*123000010~
For each ISA to IEA data set in file, and there could be several, I would like the following
desired Output Data, in a file called Output.txt:
Company: COMPANYCOL (these are the words next found next to ZZ)
Type of document: 999 (these are the numbers next to the ST)
Identifier: 123000010 (the number found in IEA)
Then below the above output, I would like a blank line, and then I would like the data from the Source.txt to be displayed underneath it.
So the Output.txt file should look something like this, in this case:
Company: COMPANYCOL
Type of document: 999
Identifier: 123000010
ISA*00* *00* *12*1234567891 *ZZ*COMPANYCOL *213456*1234*A*00123*12300 0010*1*P*> ~
GS*IN*2134567891*123456789 1*20141024 *1234*00*X *001234~
ST*999*1234561~
BIG*20141020*123456.*20140 917*123456 7.~
N1*RI*COMPANY*0*000000000~
N1*BT*COMPANY 2*0*12345678910000~
ITD*00*2*****00~
DTM*000*20141020~
FOB*CC~
IT1*1*200*CA*5.4**UN*12345 6789123*VN *01234A~
IT1*2*50*CA*1.4**UN*213456 789122*VN* 02345A~
IT1*3*60*CA*12.4**UN*78945 6123123*VN *06789A~
TDS*1234567~
ISS*1234*CA*12345*LB~
SE*12*123456~
GE*1*10~
IEA*1*123000010~
ISA*00* *00* *12*1234567891 *ZZ*COMPANYCOL *213456*1234*A*00123*12300
GS*IN*2134567891*123456789
ST*999*1234561~
BIG*20141020*123456.*20140
N1*RI*COMPANY*0*000000000~
N1*BT*COMPANY 2*0*12345678910000~
ITD*00*2*****00~
DTM*000*20141020~
FOB*CC~
IT1*1*200*CA*5.4**UN*12345
IT1*2*50*CA*1.4**UN*213456
IT1*3*60*CA*12.4**UN*78945
TDS*1234567~
ISS*1234*CA*12345*LB~
SE*12*123456~
GE*1*10~
IEA*1*123000010~
For each ISA to IEA data set in file, and there could be several, I would like the following
desired Output Data, in a file called Output.txt:
Company: COMPANYCOL (these are the words next found next to ZZ)
Type of document: 999 (these are the numbers next to the ST)
Identifier: 123000010 (the number found in IEA)
Then below the above output, I would like a blank line, and then I would like the data from the Source.txt to be displayed underneath it.
So the Output.txt file should look something like this, in this case:
Company: COMPANYCOL
Type of document: 999
Identifier: 123000010
ISA*00* *00* *12*1234567891 *ZZ*COMPANYCOL *213456*1234*A*00123*12300
GS*IN*2134567891*123456789
ST*999*1234561~
BIG*20141020*123456.*20140
N1*RI*COMPANY*0*000000000~
N1*BT*COMPANY 2*0*12345678910000~
ITD*00*2*****00~
DTM*000*20141020~
FOB*CC~
IT1*1*200*CA*5.4**UN*12345
IT1*2*50*CA*1.4**UN*213456
IT1*3*60*CA*12.4**UN*78945
TDS*1234567~
ISS*1234*CA*12345*LB~
SE*12*123456~
GE*1*10~
IEA*1*123000010~
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER