bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Search a phrase than start with 'a' and ends at 'b, middle anything


From: Bob Proulx
Subject: Re: Search a phrase than start with 'a' and ends at 'b, middle anything
Date: Sun, 8 Nov 2009 01:49:05 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

Eduardo wrote:
> I trying to search a phrase than start with 'a' and ends at 'b, middle
> anything,
> but if i use the command as '$ grep '^a * b$' like in the man, don't works,

Your pattern includes " * " which would look for zero or more spaces
followed by a single space.  This could also be described as one or
more spaces.  But you say you want it to match anything and not just
spaces.  So you would want to use ".*" instead.  The '.' matches any
character and the '*' says zero or more of the previous any character.

Try this:

  grep '^a.*b$'

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]