Once you have the tags, you can write glue code to insert the record into a database.#!/usr/bin/perl -w use strict; while (<DATA>) { if (/\${4}/) { print "End of record\n"; last; } next unless /^> <([^>]+)>$/; my $tag = $1; chomp( my $property = <DATA>); print "tag: $tag property: $property\n"; } __DATA__ (+)-catechin SMI2MOL 21 23 0 0 0 0 0 0 0 0999 V2000 0.0000 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0.0000 0.0000 0.0000 C 0 0 1 0 0 0 0 0 0.0000 0.0000 0.0000 C 0 0 0 0 0 0 0 0 1 2 1 0 0 0 0 2 13 1 0 0 0 0 19 21 1 0 0 0 0 M END > <$NAM> (+)-catechin > <Formula> C15H14O6 > <MolWeight> 290.26806 > <ChemBankID> 1254 > <CompoundName> (+)-catechin > <Calbiochem Catalog> 219250 > <MicroSource Catalog> 210205 $$$$
-Mark
In reply to Re: parsing using metacharacters
by kvale
in thread parsing using metacharacters
by myraja
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |