Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: pattern matching to separate data

by jwkrahn (Monsignor)
on May 03, 2009 at 18:15 UTC ( #761604=note: print w/replies, xml ) Need Help??


in reply to pattern matching to separate data

This should do what you want:

#!/usr/bin/perl use warnings; use strict; open OUT1, '>', 'GENEID.out' or die "can not create 'GENEID.out' $!"; open OUT2, '>', 'PROTID.out' or die "can not create 'PROTID.out' $!"; open FILE, '<', 'input.txt' or die "can not open 'input.txt' $!"; while ( my $line = <FILE> ) { select OUT1 if $line =~ /^>data_\d+\s+GENEID_\d+\b/; select OUT2 if $line =~ /^>data_\d+\s+PROTID_\d+\b/; print $line; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://761604]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2021-01-18 17:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?