![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Extracting records with unique fields from a fixed width txt file | sitney | Shell Programming and Scripting | 8 | 02-10-2008 03:18 AM |
| extracting fields | prvnrk | Shell Programming and Scripting | 2 | 10-08-2007 04:39 AM |
| Extracting information from text fields. | spindoctor | UNIX for Dummies Questions & Answers | 24 | 06-09-2007 02:17 PM |
| Removing certain fields from a file | sendhilmani123 | Shell Programming and Scripting | 1 | 05-02-2006 03:01 AM |
| Extracting fields from an output 8-) | csaha | Shell Programming and Scripting | 6 | 01-20-2006 08:37 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Removing LF and extracting two fields
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> |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|