I'm grepping a bunch of code looking for all code that executes SQL. My problem is that some of the queries span across several lines and I can't seem to make grep honor (?s) for that, which according to my regex tester, is supposed to work. Here's an example:
grep -R -E 'select.*from.*;' . -Recursively check all subdirs -Extended regex find all lines that contain "select" followed by any number of characters ".*" followed by "from" followed by any number of characters ".*" followed by ";" and start the search in the current dir so that matches the following fine: String sql = "select * from mytable where id=1"; however, it does not match the following: String sql = "select * from mytable where id=1" <line break> + " and name='foo'"; i tried adding the directive (?s) but then grep finds nothing grep -R -E '(?s)select.*from.*;' . so my main question then is, how do you make grep regexp span across lines? thanks!! -- View this message in context: http://www.nabble.com/grep-regex-across-line-boundaries-tp18946632p18946632.html Sent from the Gnu - Grep mailing list archive at Nabble.com.
