From: Marc Hoeppner Date: 2007-07-12T17:38:57+09:00 Subject: Stripping columns / puts'ing columns Hi again, still on my quest to learn ruby ;) And yet another question - more a general "how-to-approach" thing, though. Let's say I have a text file with a number of rows (it's a molecular sequence alignment, so each row = one sequence). I am only interested in those columns in which a certain character appears - no matter whether in all row or only one. The whole column should then be puts'ed. After thinking about it for a moment, my idea was to store each row in an array, check each array position for the presence of that particular character and, if it is, found, to puts this array field [n] and the corresponding field from all other arrays. Now, there are a couple of potential problems such as hitting the same column multiple times because I search multiple arrays... But anyways, since I am rather new to programming and ruby in particular, that will take me a while - so I was wondering if there is a more elegant/efficient approach to this, before I waste my time on this only to find out it doesnt work or could be done more efficiently (wasted quite some time on another program the other day only to find out that it can be done with grep...yuck). /Marc -- Posted via http://www.ruby-forum.com/.