[R] Regex for Special Characters under Grep

Gundala Viswanath gundalav at gmail.com
Fri Jun 13 03:42:37 CEST 2008

Hi all,

I am trying to capture lines of a file that DO NOT
start with the following header: !, #, ^

But somehow my regex used under grep doesn't

Please advice what's wrong with my code below.

in_fname <- paste("mydata.txt,".soft",sep="")
data_for_R <- paste("data_for_R/", args[3], ".softR", sep="")

# my regex construction
cat(temp[-grep("^[\^\!\#]",temp,perl=TRUE)], file=data_for_R, sep="\n")

dat <- read.table(data_for_R)

- Gundala Viswanath
Jakarta - Indonesia

More information about the R-help mailing list