o***@algosyn.com
2010-02-13 13:34:45 UTC
Hello,
I need to extract info from some text files. And I want to do it with
Perl !
The file I need to parse has the following layout:
keywordA word1, word2, word3;
Here we can have some free text
...
...
keywordB word4,
word5, word6, word7, word8,
word9, word10;
KeywordA
word1, word2;
...
I want to extract all the "keywords" with their associated words.
For example, with this file, I would like to have:
keywordA: (word1, word2, word3)
keywordB: (word4, word5, word6, word7, word8, word9, word10)
keywordA: (word1, word2)
Is it possible to do this with regular expression ?
Or should I write a small parser ?
I have tried pattern matching with the 's' and also with the 'm'
option,
but with no good result ...
Thanks to help me !
Olivier
I need to extract info from some text files. And I want to do it with
Perl !
The file I need to parse has the following layout:
keywordA word1, word2, word3;
Here we can have some free text
...
...
keywordB word4,
word5, word6, word7, word8,
word9, word10;
KeywordA
word1, word2;
...
I want to extract all the "keywords" with their associated words.
For example, with this file, I would like to have:
keywordA: (word1, word2, word3)
keywordB: (word4, word5, word6, word7, word8, word9, word10)
keywordA: (word1, word2)
Is it possible to do this with regular expression ?
Or should I write a small parser ?
I have tried pattern matching with the 's' and also with the 'm'
option,
but with no good result ...
Thanks to help me !
Olivier