Help: Korn Shell & egrep!

Help: Korn Shell & egrep!

Post by Eisen Ch » Thu, 17 Aug 2000 04:00:00



To All:

In Perl, after you do a REGEX search, you can
get some of the backreferenced values. That is:

($temp = "14-Aug-2000") =~ s/(\d\d)-(.*)-(\d+)/;

so that:

  $1 = 14
  $2 = 'Aug'
  $3 = 2000

Now I can do this with egrep:

  ls -al | egrep 'Aug [0-9]+'

which returns:

  0 - found
  1 - not found
  2 - error

How do I get the '[0-9]+' value ? I've seen something
documented for regex like:

`ls -al | regex 'Aug ([0-9]*)$0' '$m0' '
                                       ^
                                       |
                                      ` or ' ?

then:

     dayofmonth=$m0

But this syntax doesn't seem to translate over to egrep too well.

Thanks in advance,

Eisen