Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: perl script

by citromatik (Curate)
on Jun 24, 2009 at 12:04 UTC ( #774368=note: print w/replies, xml ) Need Help??


in reply to perl script

perl -lne '/gi\|(\d+)\|/ && push @sofar,$1}{$,=",";print @sofar' <yourfile>

citromatik

Replies are listed 'Best First'.
Re^2: perl script
by ack (Deacon) on Jun 24, 2009 at 18:10 UTC

    I used a similar idea but did as follows:

    my $file = '...the OPs File example..." #used as a string # to simplify my # test my @gi_ids = $file =~/gi\|(\d+)\|/g;

    That leaves the list @gi_ids containing all of the gi id's that were in the string (i.e., it finds 4 gi id's in the OPs example).

    Just another possible strategy. It looks to me like all of the respondents' ideas would work fine. Mine is just another variation.

    Hope that helps.

    ack Albuquerque, NM

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://774368]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2016-12-11 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (168 votes). Check out past polls.