[R] Delete Comment Lines from SQL String as a Vector

Mai Dang mdmining at gmail.com
Tue Feb 22 00:08:53 CET 2011


Hi,
I tried to remove the text starts by "--" to the end of the line as below


sql=c("-- This is a comment line",
         "select sysdate  -- This is a comment Text" ,
         " from dual ")
>sql
[1] "-- This is a comment line"
[2] "select sysdate  -- This is a comment Text"
[3] " from dual "


I try to have this
> sql
[1] "select sysdate "
[2] " from dual "

Thank You for your help,
Mai Dang



More information about the R-help mailing list