I need some assistance, I am writing a script in bash.
I want to do two things:
1/. I want to replace the LF at the end of the RFH � �MQSTR � so I can process the file record by record using a while loop.
2/. I want to extract two fields from each record, they are identified with tabs <RequestID></RequestID> and <error:Info></error:Info> from the sample data below.
In my file as shown below, each record in the file starts with: RFH � �MQSTR � followed LF followed by the data:
RFH � �MQSTR �
<usr><SourceID>SYSA</SourceID><DSType>SPIResults</DSType><Source>SYSA</Source><Destina
tion>PortalSystem</Destination><RequestID>1000005</RequestID><TargetTablePrimaryKey>5</
TargetTablePrimaryKey><Replay><Original/><Current><DestinationSystemID>SYSA</DestinationSy
stemID></Current></Replay><TargetURI>SYSB</TargetURI><DestinationID>SYSA<
/DestinationID></usr> <mcd><Msd>xmlns</Msd></mcd> <?xml version="1.0"
encoding="UTF-8"?><error:Code>001</error:Code><error:Info>An error occured whilst trying
to process a routing request, see attached exception lists for
details</error:Info><error:OriginalExceptionData></mm:MessageMetadata><mf:MessageFormat SchemaVersion="1.0"><mf:MessageType><msg:Type>SPIResults</msg:Type><msg:Version>1.200</msg:Version>
RFH � �MQSTR �
<usr><SourceID>SYSA</SourceID><DSType>SPIResults</DSType><Source>SYSA</Source><Destina
tion>PortalSystem</Destination><RequestID>1000005</RequestID><TargetTablePrimaryKey>5</
TargetTablePrimaryKey><Replay><Original/><Current><DestinationSystemID>SYSA</DestinationSy
stemID></Current></Replay><TargetURI>SYSB</TargetURI><DestinationID>SYSA<
/DestinationID></usr> <mcd><Msd>xmlns</Msd></mcd> <?xml version="1.0"
encoding="UTF-8"?><error:Info>An error occured whilst trying to process a routing request,
see attached exception lists for details</error:Info><error:OriginalExceptionData>
RFH � �MQSTR �
<usr><SourceID>SYSA</SourceID><DSType>SPIResults</DSType><Source>SYSA</Source><Destina
tion>PortalSystem</Destination><RequestID>1000005</RequestID><TargetTablePrimaryKey>5</
TargetTablePrimaryKey><Replay><Original/><Current><DestinationSystemID>SYSA</DestinationSy
stemID></Current></Replay><TargetURI>SYSB</TargetURI><DestinationID>SYSA<
/DestinationID></usr> <mcd><Msd>xmlns</Msd></mcd> <?xml version="1.0"
encoding="UTF-8"?><error:Info>An error occured whilst trying to process a routing request,
see attached exception lists for details</error:Info></mm:MessageMetadata><mf:MessageFormat SchemaVersion="1.0"><mf:MessageType><msg:Type>SPIResults</msg:Type>