bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: grep


From: Stepan Kasal
Subject: Re: grep
Date: Mon, 24 May 2004 10:41:02 +0200
User-agent: Mutt/1.4.1i

Hello,

On Sun, May 23, 2004 at 08:57:22PM -0400, Paul Jarc wrote:
> "Alexander James Mattam" <address@hidden> wrote:
> >        grep [:digit:]    what should it return???
> 
> It should output lines that contain :, d, i, g, or t.  (But without
> quotes, the shell may change the pattern.)

this answer was right, of course.  I was too quick writing my answer.

And, to clarify:
To get lines containing at least one digit, use:
        grep '[[:digit:]]'

To get lines containing only digits:
        grep '^[[:digit:]]*$'

To get non-empty lines containing only digits:
        grep -E '^[[:digit:]]+$'

HTH,
        Stepan Kasal




reply via email to

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