Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?

by Anonymous Monk
on Sep 28, 2014 at 22:30 UTC ( [id://1102293]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    for my $letter ('A'..'Z') {
        my $file = "tmp/$letter.txt";
    ...
            say $fh join "\t", $i, map "$letter-$i-exp$_", 1..10;
        }
    }
    
  2. or download this
    Gene    exp1    exp2    exp3    exp4    exp5    exp6    exp7    exp8  
    +  exp9    exp10
    1    A-1-exp1    A-1-exp2    A-1-exp3    A-1-exp4    A-1-exp5    A-1-e
    +xp6    A-1-exp7    A-1-exp8    A-1-exp9    A-1-exp10
    2    A-2-exp1    A-2-exp2    A-2-exp3    A-2-exp4    A-2-exp5    A-2-e
    +xp6    A-2-exp7    A-2-exp8    A-2-exp9    A-2-exp10
    ...
    
  3. or download this
    @ARGV = <tmp/*.txt>;
    
    ...
    delete $row{Gene};
    
    say "$_$row{$_}" for sort {$a <=> $b} keys %row;
    
  4. or download this
    1    A-1-exp4    B-1-exp4    C-1-exp4    D-1-exp4    E-1-exp4    F-1-e
    +xp4    G-1-exp4    H-1-exp4    I-1-exp4    J-1-exp4    K-1-exp4    L-
    +1-exp4    M-1-exp4    N-1-exp4    O-1-exp4    P-1-exp4    Q-1-exp4   
    + R-1-exp4    S-1-exp4    T-1-exp4    U-1-exp4    V-1-exp4    W-1-exp4
    +    X-1-exp4    Y-1-exp4    Z-1-exp4
    2    A-2-exp4    B-2-exp4    C-2-exp4    D-2-exp4    E-2-exp4    F-2-e
    +xp4    G-2-exp4    H-2-exp4    I-2-exp4    J-2-exp4    K-2-exp4    L-
    +2-exp4    M-2-exp4    N-2-exp4    O-2-exp4    P-2-exp4    Q-2-exp4   
    + R-2-exp4    S-2-exp4    T-2-exp4    U-2-exp4    V-2-exp4    W-2-exp4
    +    X-2-exp4    Y-2-exp4    Z-2-exp4
    ...
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-19 13:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found