Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting certain lines from text file
Message
De
16/09/2009 16:49:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01424805
Message ID:
01424808
Vues:
47
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.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform