Alex Rivera | Logout

egrep search for whitespace

Asked 2009-01-15T23:40:39.373
22

I'm trying to use egrep with a regex pattern to match whitespace.

I've used RegEx with Perl and C# before and they both support the pattern \s to search for whitespace. egrep (or at least the version I'm using) does not seem to support this pattern.

In a few articles online I've come across a shorthand [[:space:]], but this does not seem to work. Any help is appreciated.

Using: SunOS 5.10

Edit
Report

1 Answer

0

Maybe you should protect the pattern with quotes (if bash, or anything equivalent for the shell you are using).

[ and ] may have special meaning for the shell.

answered 2009-01-15T23:51:56.247

Your Answer