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

Re: Off topic question about grep



On 11/09/2010 12:26 PM, Bob McGowan wrote:
> On 11/09/2010 06:00 AM, Jochen Schulz wrote:
...
>> What was your exact command line? Did you quote the regular expression?
>> My guess is that the shell interpreted the '*' character for you and you
>> ended up with a command line like this:
>>
>> $ grep [_a-zA-Z][_a-zA-Z0-9]file1 file2 file3
...

> The shell will expand the above into space separated values, based on
> matches to the glob pattern.  The first match will become the pattern
> used by grep, searched for in the remaining file names.  Try this:
> 
>   echo grep [_a-zA-Z][_a-zA-Z0-9]*
> 
> to see what the shell does in any particular case.

Yeah. I feel really silly now.

I was so focused on getting the regular expression right that I
completely forgot to consider the shell interpreting things on my
behalf. Couldn't see the forest because of the tree in my way I guess.

Thanks! I do appreciate it.

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: