Re: match across line using grep

2010-08-19 Thread Bob Proulx
Zhang Weiwu wrote: > Bob McGowan wrote: > > My point is that changing only the LANG environment variable changed the > > way 'grep' dealt with the newline character. > > You are right this really look like a problem. Where should I file the > bug? The gnu projects management looks mysterious to

Re: match across line using grep

2010-08-19 Thread Zhang Weiwu
On 2010年08月07日 06:41, Bob McGowan wrote: > My point is that changing only the LANG environment variable changed the > way 'grep' dealt with the newline character. You are right this really look like a problem. Where should I file the bug? The gnu projects management looks mysterious to me, unlik

Re: match across line using grep

2010-08-13 Thread Alan Greenberger
On 2010-08-02, Zhang Weiwu wrote: > > however, it does not match the following: > > select * from mytable where id=1 > and name='foo'"; > How about sed -n '{/id=1/N;/name=.foo/p;d;}' -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trou

Re: match across line using grep

2010-08-06 Thread Bob McGowan
On 08/05/2010 06:49 PM, Zhang Weiwu wrote: > On 2010年08月04日 04:55, Bob McGowan wrote: >> In fact, the LC_ names all seem to be specific to things >> that would not necessarily impact the regex operation. >> > It is not totally true. The encoding part might. If it is UTF-8, in > theory, [:digit:]

Re: match across line using grep

2010-08-05 Thread Zhang Weiwu
On 2010年08月04日 00:57, Bob McGowan wrote: > I would suspect > the regex engine is still honoring '. (dot) does not match newline' > convention but is OK with literals, if present. > It can be a bug in grep implementation. If your theory holds true, the following should match, but it doesn't. $

Re: match across line using grep

2010-08-05 Thread Zhang Weiwu
On 2010年08月04日 04:55, Bob McGowan wrote: > In fact, the LC_ names all seem to be specific to things > that would not necessarily impact the regex operation. > It is not totally true. The encoding part might. If it is UTF-8, in theory, [:digit:] should match more than 0-9. It might, for example,

Re: match across line using grep

2010-08-03 Thread Bob McGowan
On 08/03/2010 11:28 AM, Andre Majorel wrote: > On 2010-08-03 09:57 -0700, Bob McGowan wrote: >> On 08/03/2010 05:39 AM, Andre Majorel wrote: >>> On 2010-08-03 19:37 +0800, Zhang Weiwu wrote: On 2010???08???03??? 17:53, Andre Majorel wrote: >>> $ printf 'a\nb' | grep -zo a.*b >>> <--de

Re: match across line using grep

2010-08-03 Thread Andre Majorel
On 2010-08-03 09:57 -0700, Bob McGowan wrote: > On 08/03/2010 05:39 AM, Andre Majorel wrote: > > On 2010-08-03 19:37 +0800, Zhang Weiwu wrote: > >> On 2010???08???03??? 17:53, Andre Majorel wrote: > > $ printf 'a\nb' | grep -zo a.*b > > > > (The above should output something /if/ -z wou

Re: match across line using grep

2010-08-03 Thread Bob McGowan
On 08/03/2010 05:39 AM, Andre Majorel wrote: > On 2010-08-03 19:37 +0800, Zhang Weiwu wrote: >> On 2010???08???03??? 17:53, Andre Majorel wrote: > $ printf 'a\nb' | grep -zo a.*b > > (The above should output something /if/ -z would make egrep > not consider \n as string terminator.

Re: match across line using grep

2010-08-03 Thread Andre Majorel
On 2010-08-03 19:37 +0800, Zhang Weiwu wrote: > On 2010???08???03??? 17:53, Andre Majorel wrote: > >> > $ printf 'a\nb' | grep -zo a.*b > >> > > >> > (The above should output something /if/ -z would make egrep > >> > not consider \n as string terminator. But it has produced no > >> > output) > >>

Re: match across line using grep

2010-08-03 Thread Zhang Weiwu
On 2010年08月03日 17:53, Andre Majorel wrote: >> > $ printf 'a\nb' | grep -zo a.*b >> > >> > (The above should output something /if/ -z would make egrep >> > not consider \n as string terminator. But it has produced no >> > output) >> > But grep -z does. This would seem to be an undocumented > l

Re: match across line using grep

2010-08-03 Thread Andre Majorel
On 2010-08-02 14:56 +0800, Zhang Weiwu wrote: > I'm grepping a bunch of files each have a segment code that > executes a SQL. My problem is that the query spans across > several lines and I can't seem to make grep honor (?s) for > that. Here's an example: > > grep --E 'select.*from.*;' . "--E" ?

Re: match across line using grep

2010-08-02 Thread Karl Vogel
>> On Mon, 02 Aug 2010 14:56:45 +0800, >> Zhang Weiwu said: Z> I'm grepping a bunch of files each have a segment code that executes a Z> SQL. My problem is that the query spans across several lines and I Z> can't seem to make grep honor (?s) for that. Perl Is Our Friend. Here's some text t

Re: match across line using grep

2010-08-02 Thread Camaleón
On Mon, 02 Aug 2010 14:56:45 +0800, Zhang Weiwu wrote: > I'm grepping a bunch of files each have a segment code that executes a > SQL. My problem is that the query spans across several lines and I can't > seem to make grep honor (?s) for that. (...) Google says there is a package named "pcregre

match across line using grep

2010-08-02 Thread Zhang Weiwu
I'm grepping a bunch of files each have a segment code that executes a SQL. My problem is that the query spans across several lines and I can't seem to make grep honor (?s) for that. Here's an example: grep --E 'select.*from.*;' . so that matches the following fine: select * from mytable whe