Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User logged or never logged

Status
Not open for further replies.

adimstec

IS-IT--Management
Nov 27, 2002
52
FR
Hello,

I need to write a script in HP allowing me to know if a user has already logged in or never.

Which files are involved regarding the management of users in HP ?

Thank you for your help
 
You could write a script whick compares the first field in the passwd file with the relevant output from the last command
 
Output your finger data to : users.raw
Add this line to your script as well:
awk -f formatu.awk < users.raw > users.report

vi a file called formatu.awk in whatever directory you are working and cut and paste the following awk script:

/^Login / {daname=$3;next}
/^Directory/ {dadir=$2;next}
/^Never / {dalast="Never"
printf("%-9s %-40s %-s \n", daname, dadir, dalast);
next}
/^Last login/ {dalast=$3" "$4" "$5" "$6;
printf("%-9s %-40s %-s \n", daname, dadir, dalast);
next}
Double check to make sure that the full printf lines are on one line in the file and that should do it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top