Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Fixed-width text log fields are parsed differently from CSV log fields. In a comma-separated-values log, an individual field can contain any number of characters; by definition, a field contains all the characters that precede a comma. For example, the following are valid comma-separated-values fields, even though the fields consist of different field lengths:
Computer,Domain WebServer,fabrikam.com FinancialAccountingServer,finance.accounting.fabrikam.com
In a fixed-width text log, fields are delimited by length rather than by a comma or other character. The fields in any given record must be exactly the same size as fields in all the records.
For example, in NetSetup.log, there are three fields: date, time, and description. As shown in the following log excerpt, date begins with the first character, time with the seventh character, and description with the sixteenth character (numbers have been added to help indicate character positions):
123456789012345678901234567890123456789012345678901234567890 08/16 11:50:49 NetpDoDomainJoin 08/16 11:50:49 NetpMachineValidToJoin: 'WINTEST' 08/16 11:50:49 NetpGetLsaPrimaryDomain: status: 0x0 08/16 11:50:49 NetpMachineValidToJoin: status: 0x0
When this log is parsed, the first record is split into these three fields:
Listing 12.18 contains a script that parses the fixed-width-column log Netsetup.log. To carry out this task, the script must perform the following steps:
Listing 12.18 Parsing a Fixed-Width-Column Log
|
|
Send us your feedback | « Previous | Next » |