1834165 Members
2538 Online
110064 Solutions
New Discussion

regular expression

 
mo jaber
Occasional Contributor

regular expression

hi,
I need a regular expression that returns the user name(s) only!!!
from the output of the "who" command.


user name
ronajt pts/1 Apr 21 14:50
root pts/2 Apr 21 14:52
dorint pts/3 Apr 21 14:52
allago pts/4 Apr 21 15:01
7 REPLIES 7
Scott Palmer_1
Trusted Contributor

Re: regular expression

who | awk '{print $1}'
works for me

if you want something a bit more envolved, i can do that too

Regards

Scott
Todd McDaniel_1
Honored Contributor

Re: regular expression

who |awk '{ print $1 }'

should work...
Unix, the other white meat.
Todd McDaniel_1
Honored Contributor

Re: regular expression

LOL missed being first by 27 seconds!!! hehe


no points here. plz
Unix, the other white meat.
Scott Palmer_1
Trusted Contributor

Re: regular expression

amazing that we though of the same thing, guess that is the best way to do it!!
RAC_1
Honored Contributor

Re: regular expression

missed by 17 seconds

There is no substitute to HARDWORK
Jeff_Traigle
Honored Contributor

Re: regular expression

Just to be difficult and different... :)

who | cut -f1 -d" "
--
Jeff Traigle
Kent Ostby
Honored Contributor

Re: regular expression

who -q will give you just a list of user names although there multiple per line.

Best regards,

Kent M. Ostby
"Well, actually, she is a rocket scientist" -- Steve Martin in "Roxanne"