[Jprogramming] Scanning a large file
Yoel Jacobsen
yoel.jacobsen at gmail.com
Sun May 14 20:00:43 HKT 2006
Even for regex, I don't see how to avoid manually reading the file in chunks
which is too imperative style for me. Again, consider the Python example:
for line in file.readlines():
match_object = re.search("(<= csn )\w+", line)
if match_object:
process(match_object.group(0))
The regex can be precompiled as well.
This works on a 5GB file as well as on small files since readlines() take
care for reading the file in chunks.
Is there a way to do it a consice way in J?
Yoel
On 5/14/06, bill lam <bbill.lam at gmail.com> wrote:
>
> If the file is really large, I prefer regex instead.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
More information about the Programming
mailing list