Re: [R] Extract lines from file

2013-04-05 Thread arun
Hi Utpal, You can use the same script from my previous email.   Lines1<- readLines("groups.txt") library(stringr) res<-paste(gsub("(.*\\:).*","\\1",Lines1),unlist(lapply(str_match_all(Lines1,"or10\\|\\d+"),paste,collapse=" ")),sep=" ") write.table(res,"res1.txt",row.names=FALSE,col.names=FALSE,

Re: [R] Extract lines from file

2013-04-05 Thread arun
HI, " btw, could this program be modified such that it take direct input from my input.txt file???"  Lines1<-readLines("utpalmtbl.txt") Lines1 #[1] "OG1: or10|1345 or10|387 or10|474 or11|1203 or11|182 or10|2158 or12|637" #[2] "OG2: or10|1562 or10|1584 or10|1977 or11|2263 or11|43"