[Top][All Lists]

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

Re: grep

From: Eric Blake
Subject: Re: grep
Date: Mon, 18 Apr 2011 14:37:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On 04/18/2011 06:11 AM, Daniel Schade wrote:
> Dear gnu.org Team,
> I have useed grep to search for double minus in a string and grep told me an
> error, take a look to the samples
> address@hidden echo "Test --" | grep -i '--'

This is not a bug in grep, but a misunderstanding on your part at how to
delimit the end of options.


echo "Test --" | grep -i -- --

instead.  The first -- tells grep that all remaining arguments are not
options, but literal operands, so that the second -- can be used as the
search pattern.

This behavior is required by POSIX for most utilities (there are a few
exceptions, such as echo, but in general -- processing is a useful idiom
to know).

> address@hidden grep --version
> grep (GNU grep) 2.5.1

You may want to consider upgrading - the latest stable version is 2.7,
and fixes several bugs present in 2.5.1.

Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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