Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
GeneID: 1002 Name: cadherin 4, type 1, R-cadherin (retinal) Chromo: 20 Cytoband: 20q13.3 Nucleotide Sequence: atgaccgcgggcgccggcgtgctccttctgctgctctcg acagcgagactggagatatcgtcacagtggcggctggcctggaccgagagaaagttcagc cagcttgcgcatcctgtacctggaggccgggatgtatgacgtccccatcatcgtcacaga
#!/usr/bin/perl -w use strict; use autodie; open FH, '<', 'test.dat'; my @data = <FH>; close FH; open FH2, '>', 'seq.dat'; for (@data) { if (/Name:\s(.*?).*Nucleotide\sSequence:\s(.*?)/xms) { print FH2 $1, $2, "\n\n"; } } close FH2;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extracting multiple rows in a text file with a regex.
by Skeeve (Parson) on Jul 28, 2013 at 09:02 UTC | |
|
Re: Extracting multiple rows in a text file with a regex.
by 2teez (Vicar) on Jul 28, 2013 at 09:51 UTC | |
by Skeeve (Parson) on Jul 29, 2013 at 06:05 UTC | |
|
Re: Extracting multiple rows in a text file with a regex.
by Loops (Curate) on Jul 28, 2013 at 07:34 UTC | |
by Anonymous Monk on Jul 28, 2013 at 07:56 UTC | |
by Loops (Curate) on Jul 28, 2013 at 08:24 UTC | |
by Anonymous Monk on Jul 28, 2013 at 07:47 UTC | |
by Athanasius (Archbishop) on Jul 28, 2013 at 08:30 UTC |