# How to import (from a table file) only rows with a specific element in a given position using Import?

I have a large file containing a table. To be specific, the table columns are aligned by spaces, and the rows are terminated by newlines.

I want to import only specific rows from this table. For example, I would like to import only those rows that have the string "Abc" as their 3rd entry.

How can I do this without importing the whole file?

• str = OpenRead[fn]; "loop over" ReadLine[str]; Parse third element and compare to "Abc" and AppendTo based upon the comparison. – John Morganthau Feb 3 '15 at 23:18
• @JohnMorganthau, if you don't know the number of lines you will fetch before you do so, it is better to use Reap and Sow instead of AppendTo ;) – Marius Ladegård Meyer Feb 4 '15 at 10:41
• @MariusLadegårdMeyer I'm trying to create an example for this, but I'm not able to use the OpenRead function. Could you create a answer for this? – LCarvalho Dec 20 '16 at 13:18