Hi there,

I have a large/huge text file. I need to locate a line in the file with a specific string, for example, "Data Points". Now, I use the following code to do:

df <- readLines(file)
l <- grep("Data Points", df)

However, in this case, the file will be read throughout into R. When the file is huge, it will cost much memory and time.

Is there any more elegant way to do that? Thanks.

Best,
Jinsong

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to