joec_ has asked for the wisdom of the Perl Monks concerning the following question:
I have a file in a specific format (see below), with line breaks and tabs in specific places. What i need to do group it up to 'M END' and then append $$$$ after 'M END' to make it individual elements - im not bothered about the stuff after M END - that can be discarded. I gather i can use a regex for this, but keep hitting problems with line breaks.
File::
-OECHEM 658567-
1 2 0000 V2000
4 \t 5 8.7 7.655 3
2 \t 55 6 4 5
M END
> <compound id>
665765765
> <source>
db1
$$$$
-OECHEM 35343-
3 6 0000 V2000
1 \t 7 6 4.6 9
2 \t 45 0 3 5
M END
> <compound id>
3546789
> <source>
db1
$$$$
Any ideas appeciated.
TIA - Joe
please note that between M and END there is two spaces.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regex for matching and appending
by moritz (Cardinal) on Dec 10, 2008 at 09:09 UTC | |
by joec_ (Scribe) on Dec 10, 2008 at 10:03 UTC | |
by moritz (Cardinal) on Dec 10, 2008 at 10:21 UTC | |
by joec_ (Scribe) on Dec 10, 2008 at 12:50 UTC | |
by moritz (Cardinal) on Dec 10, 2008 at 14:11 UTC | |
by toolic (Bishop) on Dec 10, 2008 at 14:17 UTC |