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. Perhaps this

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 the beginning

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

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard howar...@wam.umd.edu 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

Re: Repalcement for grep(1)

1999-07-07 Thread Jamie Howard
On 7 Jul 1999, Dag-Erling Smorgrav wrote: Jamie Howard howar...@wam.umd.edu 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

Re: Repalcement for grep(1)

1999-07-07 Thread Dag-Erling Smorgrav
Jamie Howard howar...@wam.umd.edu 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

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:

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 with

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 with

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 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 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 with

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-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 see

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. It

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 -num 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 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 code. I

Re: Repalcement for grep(1)

1999-07-04 Thread Dag-Erling Smorgrav
Jamie Howard howar...@wam.umd.edu 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-04 Thread Dag-Erling Smorgrav
Jamie Howard howar...@wam.umd.edu 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

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 -num 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 Marc Espie
On Sun, Jul 04, 1999 at 02:13:13PM +0200, Dag-Erling Smorgrav wrote: Jamie Howard howar...@wam.umd.edu 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

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 the

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 characters

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