Re: Parsing a mostly fixed width text file
- From: "News Reader" <newsreader@xxxxxxxxxxxxxxx>
- Date: Wed, 7 Dec 2005 16:39:26 -0500
Rick,
Thanks. I will definitely utilize that optional argument.
"Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
wrote in message news:%23IrDhL0%23FHA.4088@xxxxxxxxxxxxxxxxxxxxxxx
>> The delimiter is a space, the problem is that will work to create
> the first
>> 3 columns. After that, it's a memo field that tends to get broken
> apart
>> because of the spaces. I would need a way to create the first three
>> columns. The last character of the third field should always be an
> ending
>> square bracket.
>>
>> ***START SAMPLE***
>> 2005-11-28 12:30:49.812 [pid=0x27c,tid=0x4a0] Entering
>> ProcessGroupPolicyExDrives()
>> 2005-11-28 12:30:49.828 [pid=0x27c,tid=0x4c0] Set thread desktop.
>> 2005-11-28 12:30:49.828 [pid=0x27c,tid=0x4c0]
>> SOFTWARE\Policies\Microsoft\Windows\Group
>> Policy\{1EA5E892-2292-438F-8D05-40E7B0007585}
>> 2005-11-28 12:30:49.828 [pid=0x27c,tid=0x4c0]
> BackgroundPriorityLevel ( 0 )
>> 2005-11-28 12:30:49.843 [pid=0x27c,tid=0x4c0] LogLevel ( 3 )
>
> Perhaps the Split function could be of use on a line-by-line basis.
> Using that last line as an example...
>
> Txt = "2005-11-28 12:30:49.843 [pid=0x27c,tid=0x4c0] LogLevel ( 3 )"
> Field = Split(Txt, " ", 4)
> Debug.Print Field(0)
> Debug.Print Field(1)
> Debug.Print Field(2)
> Debug.Print Field(3)
>
> Notice that indexes 0, 1 and 2 of the Field array contain the first
> three columns of information and index number 3 of the array contains
> the entire rest of the line (that is, the entire comment column). This
> "lumping" of the rest of the line into index number 3 is due to my use
> of the 3rd (normally optional) argument in the Split function. If you
> don't care about the comment text, you can leave out that optional
> argument and just ignore any indexes greater that 2.
>
> Rick
>
>
.
- References:
- Parsing a mostly fixed width text file
- From: News Reader
- Re: Parsing a mostly fixed width text file
- From: mike williams
- Re: Parsing a mostly fixed width text file
- From: News Reader
- Re: Parsing a mostly fixed width text file
- From: Rick Rothstein [MVP - Visual Basic]
- Parsing a mostly fixed width text file
- Prev by Date: Re: CORRECTED TEST AND ANSWERS.
- Next by Date: Re: Can we view a picture from its memory data?
- Previous by thread: Re: Parsing a mostly fixed width text file
- Next by thread: Re: Parsing a mostly fixed width text file
- Index(es):
Relevant Pages
|