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: Arlinta Barus
Subject: Re: How to use ']' in the upper bound of a range character set
Date: Fri, 22 May 2009 12:38:26 +1000

Thanks for telling me the other form to support  ']' by grep to replace
the range character set. 

However, I do really concern on the form of the range character set of
grep. So does it confirm that there is no way to use ']' is the RANGE
character set ? (sorry to ask the 'same' questions repeatedly just want
to get a more confident confirmation).

And are there any other characters that cannot be used inside the RANGE
character set as either the upper or lower bound ? Or is there any
documentation of grep that can advise me of this kind of limitation of
grep ?

Many thanks.

—-
Arlinta


Are there any other characters that cannot be used in the RANGE
character set ? 



>>> Dave B <address@hidden> 22/05/2009 6:04 am >>>
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]