On Thu, Dec 31, 2015 at 6:15 PM, Val Krem <
valkrem@yahoo.com> wrote:
>
>
>
> Hi all
> I wanted to search a line that contains "1235" using
> grep -R "1235".
> I am getting unwanted results such as
> 01235 or 12356 and so on.
>
> How could I avoid these and get only '1235"?
>
> Val
I don't know what you mean by "only 1235". Do you mean with no leading or trailing digits? I.e. A1235B is a match, but 01235 is not. Or do you mean "a line which contains _only_ 1235 and no other characters?
For the first, this should work: egrep '(^|[^[:digit:]])1235($|[^[:digit:]])'
({^|[^[:digit:])) matches the beginning of the string (^) or a non-digit [^[:digit:]]
then the digits "1235
($|[^[:digit:]]) then matches the end of the string ($) or a non-digit.
Oh, what does this have to do with BASH????? And how is it a bug? IOW, this looks like the wrong forum. This is not a general UNIX (or Linux) question and answer forum. You might want to get an account on StackExchange