bug-grep
[Top][All Lists]
Advanced

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

Re: How to use ']' in the upper bound of a range character set


From: Dave B
Subject: Re: How to use ']' in the upper bound of a range character set
Date: Thu, 21 May 2009 22:04:21 +0200
User-agent: Thunderbird 2.0.0.21 (X11/20090420)

Arlinta Barus wrote:
> Thanks for the reply. 
> 
> " We can't use and/or escape `]' between `[' and `]' in  grep and egrep". 
> So does it mean that grep cannot support a range character set that
> the end of the range is character ']' ? Because in the real problems,
> it is possible that we want to find a character in a range such
> that ']' is the end of the range.

] is supported but not in a rage, so you can do

echo 'ab23c]' | LC_ALL=C grep -o --color '[]1-\]'

ie, extend the range until the character preceding the ] and include ]
separately.

-- 
D.




reply via email to

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