Displaying only data matching a pattern?
Ben Scott
dragonhawk at gmail.com
Mon Feb 2 12:05:29 EST 2009
On Mon, Feb 2, 2009 at 11:58 AM, Michael ODonnell
<michael.odonnell at comcast.net> wrote:
>> sed s/.*:\([[:xdigit:]]*\)\\.*/\1/
>
> That looks good to me, though I assume he meant to show that
> expression in single quotes.
Nope. The Windows NT shell (CMD.EXE) has different meta-characters
from Bourne and company. In particular, asterisk (*), backslash (\),
and square brackets ([]) are *not* shell meta-characters.
> Also, I can't remember if those character class notations count
> as Extended Regular Expressions but ...
The sed from unxutils apparently only supports Basic Regular
Expressions. At least, it doesn't recognize the + one-or-more
modifier. It does recognize the named character classes, though. I
did run my command line on a whole one test case. ;-)
According to a random "sed" man page I found on the web, the named
character classes are part of POSIX BREs.
-- Ben
More information about the gnhlug-discuss
mailing list