http://www.perlmonks.org?node_id=421263


in reply to Genbank file parsing

if u want to extract Origin to // in the text file globally

you try this

undef $/; open (FILE, $ARGV[0]) or die "unable to open FILE\n"; my $input=<FILE>; close(FILE); my @final=(); while ($input=~m#ORIGIN(.*?)//#gsi) { push(@final,$1); } print @final;

input file "text.txt" contains

**********************************************

FEATURES Location/Qualifiers

/note="blah blah"

COUNT 200

ORIGIN

1 lots of nice info

61 lots of nice info

121 lots of nice info

//

ORIGIN

1 lots of nice info

61 lots of nice info

121 lots of nice info

//

ORIGIN

1 lots of nice info

61 lots of nice info

121 lots of nice info

//

ORIGIN

1 lots of nice info

61 lots of nice info

121 lots of nice info

//

***********************************

output file is look

**********************

1 lots of nice info

61 lots of nice info

121 lots of nice info

1 lots of nice info

61 lots of nice info

121 lots of nice info

1 lots of nice info

61 lots of nice info

121 lots of nice info

1 lots of nice info

61 lots of nice info

121 lots of nice info

Regards,

Senthi Kumar.k

Replies are listed 'Best First'.
Re^2: Genbank file parsing
by YuckFoo (Abbot) on Jan 11, 2005 at 23:08 UTC
    gube,

    A useful feature for code snippets and experiments is the special __DATA__ section that can be added at the end of your program file. You can read from the DATA file handle with no need to create and open an input file:

    #!/usr/bin/perl while (<DATA>) { print; } __DATA__ foo goo hoo

    __DataFoo__