IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Regexp help
I'm trying to find users on our Solaris 9 system that have been idle for 30+ minutes. I've come up with a partial solution, but am having trouble making a complete one. I haven't used regexp in quite some time, so figure I'm missing something; though, it's possible the Solaris regexp in grep is brain dead as I see "uses limited regular expressions" in the man page for grep.

Sample output(numbers changed to protect the innocent) from who -u is:
\nsfduser1   pts/42       Jan  5 10:26  1:22  19705       (10.x.x.x)\nsfduser2   pts/43       Jan  5 10:26  0:21  19706       (10.x.x.x)\nsfduser3   pts/44       Jan  5 10:26  0:32  19707       (10.x.x.x)\nsfduser4   pts/45       Jan  5 10:26   .    19708       (10.x.x.x)\n
I've come up with the following for users idle 30-59 minutes
who -u | grep :.*0:[3-5]\nsfduser3   pts/44       Jan  5 10:26  0:32  19707       (10.x.x.x)
and the following for users idle 60-119 minutes
who -u | grep :.*1:\nsfduser1   pts/42       Jan  5 10:26  1:22  19705       (10.x.x.x)

I'd like to combine the two into one and think the following should work, but it doesn't
who -u | grep :.*(1:|0:[3-5])
Any suggestions, or should I be satisfied I remembered what I did? :-)
Darrell Spice, Jr.                      [link|http://www.spiceware.org/cgi-bin/spa.pl?album=./Artistic%20Overpass|Artistic Overpass]\n[link|http://www.spiceware.org/|SpiceWare] - We don't do Windows, it's too much of a chore
New Use egrep.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New ding ding ding
Thanx! I had to wrap the expresion in single quotes because of the (). Also modified it to support 1-9 for the hours.

who -u | egrep ':.*([1-9]:|0:[3-5])'
Darrell Spice, Jr.                      [link|http://www.spiceware.org/cgi-bin/spa.pl?album=./Artistic%20Overpass|Artistic Overpass]\n[link|http://www.spiceware.org/|SpiceWare] - We don't do Windows, it's too much of a chore
     Regexp help - (SpiceWare) - (2)
         Use egrep. -NT - (admin) - (1)
             ding ding ding - (SpiceWare)

My Mom, who is vacationing in Aruba...
61 ms