From: Abramson, Stuart (SAbramson@Wabtec.com)
Date: Wed Aug 13 2003 - 15:15:17 EDT
hpux-admins:
Thanks to all who responded so quickly.
Script below from Steve Illgen should do it!
Also pointers to "last" and "last <username>".
Stuart
Stuart Abramson | Off: 412/825-1434 | Cell: 412/417-1567 | email:
sabramson@wabtec.com
-----Original Message-----
From: Illgen Steve 448 [mailto:steve.illgen@crackerbarrel.com]
Sent: Wednesday, August 13, 2003 2:57 PM
To: Abramson, Stuart
Subject: RE: [HPADM] How do I summarize my active users?
Here you go:
#!/usr/bin/ksh
while read LINE;do
# extract usernames and home directories from /etc/passwd
USER=$(echo $LINE|awk -F: '{print $1}')
HOMEDIR=$(echo $LINE|awk -F: '{print $6}')
# extract login info from finger using grep
LAST_LOGIN=$(finger ${USER}|grep -E 'Last login|Never logged')
echo "$USER\t$HOMEDIR\t$LAST_LOGIN"
done < /etc/passwd
exit
Not all awk, but it should work.
I hope this helps,
Steve Illgen
UNIX Systems Administrator
Cracker Barrel Old Country Store, Inc.
"Pass the Biscuits, Please!"
-----Original Message-----
From: Abramson, Stuart [mailto:SAbramson@Wabtec.com]
Sent: Wednesday, August 13, 2003 1:39 PM
To: Hpux-Admin (E-mail)
Subject: [HPADM] How do I summarize my active users?
hpux-admins:
We are moving one old server's users and applications to another old server,
to consolidate them on one server.
How do I find out who uses the old system and who doesn't.
I wrote a little script to "finger" each name in /etc/passwd:
awk -F: '{print $1}' passwd | while read USER
do
finger $USER
done
but it just spits out raw info:
Login name: lwwajeg In real life: Joe Gagor
Bldg: LPD Shippin
Directory: /home/lwwajeg Shell: /usr/bin/ksh
Last login Fri Jul 5, 2002 on ttypd
No Plan.
Login name: wiwakn In real life: Kumar
Natarajan
Directory: /home/wiwakn Shell: /usr/bin/ksh
Never logged in.
No Plan.
Login name: a334hep
Directory: /home/a334hep Shell: /usr/bin/ksh
Last login Fri Aug 8 07:20 on ttypb
No Plan.
Can I summarize that somehow with "awk"?
What I want is something like, all on one line:
username home directory Last login
Stuart
Stuart Abramson | Off: 412/825-1434 | Cell: 412/417-1567 | email:
sabramson@wabtec.com
***** CONFIDENTIALITY NOTE *****
The content contained in this e-mail transmission is legally privileged and
confidential information intended only for the use of the individual or
entity named herein. If the reader of this transmission is not the intended
recipient, you are hereby notified that any dissemination, distribution, or
copying of this transmission is strictly prohibited.
-- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search) ***** CONFIDENTIALITY NOTE ***** The content contained in this e-mail transmission is legally privileged and confidential information intended only for the use of the individual or entity named herein. If the reader of this transmission is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this transmission is strictly prohibited. -- ---> Please post QUESTIONS and SUMMARIES only!! <--- To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl Name: hpux-admin@dutchworks.nl Owner: owner-hpux-admin@dutchworks.nl Archives: ftp.dutchworks.nl:/pub/digests/hpux-admin (FTP, browse only) http://www.dutchworks.nl/htbin/hpsysadmin (Web, browse & search)
This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:32 EDT