Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
BTW, the end-of-line handling is wrong; grep will fail to select a line where the pattern appears at the end and the line is not terminated by a newline. I'm working on a fix (and on implementing my solution for -w and -x). DES -- Dag-Erling Smorgrav - d...@flood.ping.uio.no To Unsubscribe: sen

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard writes: > I am not the internationalization expert, but doesn't [^A-Za-z] and > [A-Xa-z$] limit you to just English and other Roman languages? Won't > [[:<:]] and [[:>:]] be languages independent, presuming regex supports > it? They don't DTRT. They only match whitespace boundaries

Re: Repalcement for grep(1)

1999-07-07 Thread Jamie Howard
On 7 Jul 1999, Dag-Erling Smorgrav wrote: > Jamie Howard writes: > > On Sun, 4 Jul 1999, Archie Cobbs wrote: > > >There are two special cases- of bracket expressions: the > > >bracket expressions `[[:<:]]' and `[[:>:]]' match the null > > >string at the beginning and end

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard writes: > On Sun, 4 Jul 1999, Archie Cobbs wrote: > >There are two special cases- of bracket expressions: the > >bracket expressions `[[:<:]]' and `[[:>:]]' match the null > >string at the beginning and end of a word respectively. > > Perhaps this will help w

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
BTW, the end-of-line handling is wrong; grep will fail to select a line where the pattern appears at the end and the line is not terminated by a newline. I'm working on a fix (and on implementing my solution for -w and -x). DES -- Dag-Erling Smorgrav - [EMAIL PROTECTED] To Unsubscribe: send ma

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard <[EMAIL PROTECTED]> writes: > I am not the internationalization expert, but doesn't [^A-Za-z] and > [A-Xa-z$] limit you to just English and other Roman languages? Won't > [[:<:]] and [[:>:]] be languages independent, presuming regex supports > it? They don't DTRT. They only match wh

Re: Repalcement for grep(1)

1999-07-07 Thread Jamie Howard
On 7 Jul 1999, Dag-Erling Smorgrav wrote: > Jamie Howard <[EMAIL PROTECTED]> writes: > > On Sun, 4 Jul 1999, Archie Cobbs wrote: > > >There are two special cases- of bracket expressions: the > > >bracket expressions `[[:<:]]' and `[[:>:]]' match the null > > >string at t

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard <[EMAIL PROTECTED]> writes: > On Sun, 4 Jul 1999, Archie Cobbs wrote: > >There are two special cases- of bracket expressions: the > >bracket expressions `[[:<:]]' and `[[:>:]]' match the null > >string at the beginning and end of a word respectively. > > Perh

Re: Repalcement for grep(1)

1999-07-06 Thread patl
Jamie Howard writes: > > Perhaps this will help with -w? > > Yes, I received a patch from Simon Burge which implements this. It also > beats using [^A-Za-z] and [A-Za-z$] as I was and GNU grep does. I am > still having trouble with -x though. It turns out that even if I specify > a commandline

Re: Repalcement for grep(1)

1999-07-06 Thread patl
Jamie Howard writes: > > Perhaps this will help with -w? > > Yes, I received a patch from Simon Burge which implements this. It also > beats using [^A-Za-z] and [A-Za-z$] as I was and GNU grep does. I am > still having trouble with -x though. It turns out that even if I specify > a commandlin

Re: Repalcement for grep(1)

1999-07-05 Thread Jamie Howard
On Mon, 5 Jul 1999, Archie Cobbs wrote: > Are you sure you're stripping out the newline and carriage return? You know, that did it. I'l put together another version tonight incorporating all the bug fixes and suggestions I have received over the past few days. More on that shortly. Jamie T

Re: Repalcement for grep(1)

1999-07-05 Thread Jamie Howard
On Mon, 5 Jul 1999, Archie Cobbs wrote: > Are you sure you're stripping out the newline and carriage return? You know, that did it. I'l put together another version tonight incorporating all the bug fixes and suggestions I have received over the past few days. More on that shortly. Jamie

Re: Repalcement for grep(1)

1999-07-05 Thread Archie Cobbs
Jamie Howard writes: > > Perhaps this will help with -w? > > Yes, I received a patch from Simon Burge which implements this. It also > beats using [^A-Za-z] and [A-Za-z$] as I was and GNU grep does. I am > still having trouble with -x though. It turns out that even if I specify > a commandline

Re: Repalcement for grep(1)

1999-07-05 Thread Archie Cobbs
Jamie Howard writes: > > Perhaps this will help with -w? > > Yes, I received a patch from Simon Burge which implements this. It also > beats using [^A-Za-z] and [A-Za-z$] as I was and GNU grep does. I am > still having trouble with -x though. It turns out that even if I specify > a commandlin

Re: Repalcement for grep(1)

1999-07-05 Thread Hannah Schroeter
Hello! On Sat, Jul 03, 1999 at 05:00:41PM -0400, Todd Vierling wrote: > [...] > Hm. Adding ^ and $ should work, provided you don't specify either > REG_NOTBOL or REG_NOTEOL. (I assume that (foo) above, including the parens, > is the RE. With the parens, it depends whether you're using standard

Re: Repalcement for grep(1)

1999-07-05 Thread Hannah Schroeter
Hello! On Sat, Jul 03, 1999 at 05:00:41PM -0400, Todd Vierling wrote: > [...] > Hm. Adding ^ and $ should work, provided you don't specify either > REG_NOTBOL or REG_NOTEOL. (I assume that (foo) above, including the parens, > is the RE. With the parens, it depends whether you're using standar

Re: Repalcement for grep(1)

1999-07-04 Thread Jamie Howard
On Sun, 4 Jul 1999, Archie Cobbs wrote: >There are two special cases- of bracket expressions: the >bracket expressions `[[:<:]]' and `[[:>:]]' match the null >string at the beginning and end of a word respectively. A >word is defined as a sequence of word charac

Re: Repalcement for grep(1)

1999-07-04 Thread Archie Cobbs
Jamie Howard writes: > Now, I am having a problem though. I cannot figure out how to implement > -w and -x. For -x, I tried modifying the regular expression (foo) into > ^(foo)$ before compiling, but that did not work. I intended to do > something similar with -w. Anyway, I am probably missing

Re: Repalcement for grep(1)

1999-07-04 Thread Jamie Howard
On Sun, 4 Jul 1999, Archie Cobbs wrote: >There are two special cases- of bracket expressions: the >bracket expressions `[[:<:]]' and `[[:>:]]' match the null >string at the beginning and end of a word respectively. A >word is defined as a sequence of word chara

Re: Repalcement for grep(1)

1999-07-04 Thread Archie Cobbs
Jamie Howard writes: > Now, I am having a problem though. I cannot figure out how to implement > -w and -x. For -x, I tried modifying the regular expression (foo) into > ^(foo)$ before compiling, but that did not work. I intended to do > something similar with -w. Anyway, I am probably missing

Re: Repalcement for grep(1)

1999-07-04 Thread Marc Espie
On Sun, Jul 04, 1999 at 02:13:13PM +0200, Dag-Erling Smorgrav wrote: > Jamie Howard writes: > > All of the code is original except for binary.c. It is used with the -a > > option to prevent searching binary files. binary.c is extricated from > > less-332's binary checking code. I was just that

Re: Repalcement for grep(1)

1999-07-04 Thread Marc Espie
On Sun, Jul 04, 1999 at 02:13:13PM +0200, Dag-Erling Smorgrav wrote: > Jamie Howard <[EMAIL PROTECTED]> writes: > > All of the code is original except for binary.c. It is used with the -a > > option to prevent searching binary files. binary.c is extricated from > > less-332's binary checking cod

Re: Repalcement for grep(1)

1999-07-04 Thread Tim Vanderhoek
On Sun, Jul 04, 1999 at 02:09:47PM +0200, Dag-Erling Smorgrav wrote: > > This should be trivial to translate to C. The only non-trivial part of > implementing this stuff is that you have to trick getopt() to make > - work. You'll have to put a : at the start of your getopt() > string and examine e

Re: Repalcement for grep(1)

1999-07-04 Thread Dag-Erling Smorgrav
Jamie Howard writes: > All of the code is original except for binary.c. It is used with the -a > option to prevent searching binary files. binary.c is extricated from > less-332's binary checking code. I was just that lazy. Less's binary checking code is a tad too strict. It complains about fi

Re: Repalcement for grep(1)

1999-07-04 Thread Dag-Erling Smorgrav
Jamie Howard writes: > I made the version in FreeBSD 4.0 my target except for -A num, -B num, -C, > -num, and -Z. These are not required by the Single Unix Specification or > POSIX and I felt they would bloat my code too significantly. I find those quite useful, and I don't see how they'd bloa

Re: Repalcement for grep(1)

1999-07-04 Thread Tim Vanderhoek
On Sun, Jul 04, 1999 at 02:09:47PM +0200, Dag-Erling Smorgrav wrote: > > This should be trivial to translate to C. The only non-trivial part of > implementing this stuff is that you have to trick getopt() to make > - work. You'll have to put a : at the start of your getopt() > string and examine

Re: Repalcement for grep(1)

1999-07-04 Thread Dag-Erling Smorgrav
Jamie Howard <[EMAIL PROTECTED]> writes: > All of the code is original except for binary.c. It is used with the -a > option to prevent searching binary files. binary.c is extricated from > less-332's binary checking code. I was just that lazy. Less's binary checking code is a tad too strict. I

Re: Repalcement for grep(1)

1999-07-04 Thread Dag-Erling Smorgrav
Jamie Howard <[EMAIL PROTECTED]> writes: > I made the version in FreeBSD 4.0 my target except for -A num, -B num, -C, > -num, and -Z. These are not required by the Single Unix Specification or > POSIX and I felt they would bloat my code too significantly. I find those quite useful, and I don't

Re: Repalcement for grep(1)

1999-07-03 Thread Todd Vierling
On Sat, 3 Jul 1999, Jamie Howard wrote: : I also do not use mmap(), I treat the file as a simple stream : instead. My code is also a bit slower on larger files, but a bit faster : on smaller files. Sometimes I am an order of magnitude slower. I am : never that much faster. I think not using m

Re: Repalcement for grep(1)

1999-07-03 Thread Todd Vierling
On Sat, 3 Jul 1999, Jamie Howard wrote: : I also do not use mmap(), I treat the file as a simple stream : instead. My code is also a bit slower on larger files, but a bit faster : on smaller files. Sometimes I am an order of magnitude slower. I am : never that much faster. I think not using mm

Repalcement for grep(1)

1999-07-03 Thread Jamie Howard
I have used FreeBSD for a couple years now. It is the only OS on my desktop. I have learnt many things from its source. I felt it was time to give something back. A few minutes later I decided to offer it to all BSDs. I also will offer it to the DaemonLinux group, Apple, the Darwin group, an

Repalcement for grep(1)

1999-07-03 Thread Jamie Howard
I have used FreeBSD for a couple years now. It is the only OS on my desktop. I have learnt many things from its source. I felt it was time to give something back. A few minutes later I decided to offer it to all BSDs. I also will offer it to the DaemonLinux group, Apple, the Darwin group, and