I have a file that contains a specific line that begins with "***" How can I find the line with this string since it begins with wild cards?
I would normally use
Line_n <- grep("*** The Maximum 1hour", readLines(con=filename))
Thanks!
I have a file that contains a specific line that begins with "***" How can I find the line with this string since it begins with wild cards?
I would normally use
Line_n <- grep("*** The Maximum 1hour", readLines(con=filename))
Thanks!
s <- c("** The Maximum 1hour", "*** The Maximum 1hour",
"*** The Maximum 2hours", "The Maximum 1hour",
"*** The Maximum 1hour", "+++ The Maximum 1hour",
"dummy *** The Maximum 1hour")
grep("^[*]{3} The Maximum 1hour", s)
[1] 2 5
finds strings with exactly 3 asterisks at the beginning of the string (but only then).