Discussion Locked

Perl - question.

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm trying to build a small script which would print the following when run:
Name1, Lastname1 23 2001-03-01
Name2, Lastname2 22 2001-01-16

The first part is the real name from the /etc/passwd file, the second part how many times logged on, and the date when last logged on in the format yyyy-mm-dd.

I would also like to be able to enter a user name at the command line and bring the records for that user such as:
$filename.pl jsmith
John Smith 39 2001-03-12

Thanks for the help.

3 replies

by kevin anderson

Why not just use the built in command,

FINGER JSMITH

You'll get that and more. If you want, you could also use GREP to combine it into exactly what you're after, but I suspect that everything Finger would show will be fine (where they loggedin from, If they are logged in, then it shows how long they've been logged in, a bit about MAIL, etc.

At your Prompt, type finger root, and you'll see all the info...

I think this is exactly what you're after. And it comes built into *NIX right out of the box.

Kev.

This discussion is closed to new replies.