X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Wed, 25 Nov 2009 15:19:43 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: Cygwin bash regexp matching doesn't treat "\b" properly Message-ID: <20091125201943.GA28336@ednor.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <26500158 DOT post AT talk DOT nabble DOT com> <26500814 DOT post AT talk DOT nabble DOT com> <4B0C4C2A DOT 3080502 AT gmail DOT com> <26503748 DOT post AT talk DOT nabble DOT com> <408995400911241354p27f2c5eek94973673d24fa3b3 AT mail DOT gmail DOT com> <26504147 DOT post AT talk DOT nabble DOT com> <0105D5C1E0353146B1B222348B0411A208A497494E AT NIHMLBX02 DOT nih DOT gov> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0105D5C1E0353146B1B222348B0411A208A497494E@NIHMLBX02.nih.gov> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Wed, Nov 25, 2009 at 10:33:53AM -0500, Buchbinder, Barry (NIH/NIAID) [E] wrote: >aputerguy sent the following at Tuesday, November 24, 2009 5:10 PM >>Seriously, there are times to use Perl and times not to... But >>launching perl seems a bit of overkill when I just have to do a simple >>match in a .bashrc script or when I need a small shell script wrapper. > >Looking at the man page for everything in /bin that matches the pattern >*.exe find the following that may be of interest. Testing to see if >these actually work is left as an exercise for the OP. :-) > >pcregrep - a grep with Perl-compatible regular expressions. > >grep, egrep, fgrep - print lines matching a pattern -w, --word-regexp >Select only those lines containing matches that form whole words. The >test is that the matching substring must either be at the beginning of >the line, or preceded by a non-word constituent character. Similarly, >it must be either at the end of the line or followed by a non-word >constituent character. Word-constituent characters are letters, >digits, and the underscore. If you're interested in a grep which uses perl regexes then: % grep --help Usage: grep [OPTION]... PATTERN [FILE]... Search for PATTERN in each FILE or standard input. PATTERN is, by default, a basic regular expression (BRE). Example: grep -i 'hello world' menu.h main.c Regexp selection and interpretation: . . . -P, --perl-regexp PATTERN is a Perl regular expression . . . cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple