Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by frozenwithjoy (Priest)
on Sep 28, 2014 at 19:40 UTC ( #1102282=note: print w/replies, xml ) Need Help??


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

This results in a file with 2 columns and 1,000,000 rows, right? I'm not entirely sure, but I think that OP wants the final file to have 1000 + 1 columns and 1000 rows. Maybe...
  • Comment on Re^2: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?

Replies are listed 'Best First'.
Re^3: Is there any efficient way i can take out a specific column from hundreds of files and put it in one file?
by coolda (Novice) on Sep 28, 2014 at 19:54 UTC
    Sorry for not writing a detailed description of what i am working on. So i have thousands of files in a tab delimited format saved in one folder. Each file has a format of 2000 by 10 table What i want to do right now is create new file with the data i want. So the format of each file follows ..
    Gene exp1 exp2 exp3 exp4 ... 1 1050 2020 100 100 2 100 100 100 100 3 224 11 11 11 4 11 15 555 444 5 22 51 55 555 6 55 55 55 555 ...
    From the first file i read, I want to extract two columns for example I want 'Gene' and 'exp4' columns and put it in a new file. And from the rest of the other files, I want to extract 'exp4' column only and add on the right side of the two columns i extracted from the first file. So the final format would look like
    Gene file1 exp4 file2 exp4 file3 exp4 file4 exp4.... 1 100 200 155 144 2 22 55 222 444 3 4 5 6 . .
    So it will have a 2000 by thousands(number of my files) table as a result. I am a beginner in programming and especially in perl. help me please..
      In that case, the second code snippet in my previous answer should do the trick if you are on Linux or OS X.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-10-01 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (10 votes). Check out past polls.

    Notices?