[R] Search for a text string and write position related data to a file
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Thu Oct 2 22:56:26 CEST 2003
"Karin & Gerard Preusting" <Karin at preusting.fol.nl> writes:
> Dear all,
>
> I just started using R today. What I need to do is find a text
> string in a (large) text file and than copy the some position
> related lines (or text) to an other text file. Is this possible with
> R?
It's hardly a typical R application, but it can be done using a fairly
straightforward while loop. See documentation for readLines,
writeLines, and grep. (On Unix-like systems, tools like awk or perl
will probably get the job done more quickly).
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list