in reply to Vertical Regex
Not sure how stable is the file structure, maybe you really should write a parser, as suggests JavaFan, but the following example would work on the given input:
use strict; use warnings; open my $fh, "<", "file.frg"; while(<$fh>) { if (/^{FRG/../^}/){ if (/^acc:(\d+)/) { print ">$1\n"; } elsif ( /^seq:/ ) { while(<$fh>) { last if /^\./; print; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Vertical Regex
by joomanji (Acolyte) on Jun 04, 2009 at 16:27 UTC | |
by zwon (Abbot) on Jun 04, 2009 at 17:18 UTC |