I have several directories which contain large Java files and I would like to pull out all the log messages. This includes log.error, .info, etc. In general, they look something like this:
logger.error("some message here");
The problem is that some of these messages include line breaks, and therefore grep is not picking up the full message:
logger.debug("operation [" + j + "] = whatever " + ids[j] +
" name: " + names[j] + " time: " + times[j]);
Is there a way that I can use regular expressions to get the entire Java statement, up to the semicolon?
Here is what I have so far:
grep -rn --include \*.java "\b\.error(\"\b" *