comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: extracting specific substrings from a text-file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: extracting specific substrings from a text-file [message #54508] Tue, 19 June 2007 06:42
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Jun 19, 7:59 am, BavarianMike86 <jo.mich...@gmx.de> wrote:
> Hello!
>
> I have following text-file:
>
> ---INT---
> 123
> 435
> 789
>
> ---EST--
> abc
> def
>
> ---SAT---
> x234
> y567
> z01
>
> Now I want to extract these substrings:
>
> a = '123, 456, 789'
> b = 'abc, def'
> c = 'x234, y567, z01'
>
> How can this problem be resolved?
>
> Greeting from Bavaria,
> Michael

How about:
Read each line
Use a case statement to compare with "---INT", "---EST", "---SAT"
Read each line and concatenate with the previous until you hit NULL
string (blank line)
Repeat...
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: How to retrieve information from an event to use it in another event?
Next Topic: Reading binary files made by Python

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:03:04 PDT 2025

Total time taken to generate the page: 0.00483 seconds