Is there an R function that would search for s string within a text file? Something like unix grep?
I guess the alternative will be to read the file line by line but was wondering if that can be bypassed by such a function?
Is there an R function that would search for s string within a text file? Something like unix grep?
I guess the alternative will be to read the file line by line but was wondering if that can be bypassed by such a function?
1) Read it in and use R's
grep
:2) Another possibility if you have grep on your system and on the search path is:
On Windows you could use
findstr
in place ofgrep
or if you have Rtools installed but not on your pathshell("C:\\Rtools\\bin\\grep a myfile.dat")
.