Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Deleting certain lines from text file
Message
 
 
To
16/09/2009 16:49:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01424805
Message ID:
01424809
Views:
39
Thank you very much for your suggestion. I forgot about function alines(); this should do the job.

Suggestion using regular expression is interesting from the stand point of learning how to create a pattern. I have never used regular expressions so this will be a challenge.

>To process the text file, one option is to read it with FileToStr(), separate it into lines with alines(), and then loop through the array (one array element for each line in the original file).
>
>In earlier versions of Visual FoxPro, alines() would fail for more than 65,000 lines (i.e., 65,000 array elements); in VFP 9 you should no longer have this problem.
>
>Another option is using LLFF. Those have options of reading, or writing, one line at a time.
>
>For the other part, of actually detecting which lines are timestamps, Naomi's reply is an option; or you might just check whether the first two bytes are digits, followed by a colon, for example.
>
>>Hi,
>>
>>I am trying to remove from a text file (which is a text version of a movie subtitles) all lines indicating the time stamp.
>>The format of the lines is as following:
>>
>>
>>1
>>00:02:15,257 --> 00:02:16,246
>>Hello.
>>
>>2
>>00:02:25,937 --> 00:02:29,213
>>Some text here
>>some more text here.
>>
>>3
>>00:02:29,337 --> 00:02:32,488
>>More text here
>>and more text here
>>
>>
>>I would like to create a VFP program to open this text file and remove all lines that have "99:99:99,999 --> 99:99:99,999"
>>
>>Most lines of the text start with 00: so if I can find a way to clean up those lines then I can work on the rest.
>>Therefore I need a way to find a line that starts with "00:" and ends with carriage return. How can I do it?
>>
>>Thank you in advance for any suggestions.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform