The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
[ HOME | TOPICS | INDEX | WEB RESOURCES | BOOKS | CONTRIBUTE | SEARCH | FEEDBACK | FAQ | FORUMS ]

FreeBSD Support
 New Topic  |  Go to Top  |  Go to Topic  |  Search  |  Log In   Newer Topic  |  Older Topic 
 How to list users using awk.
Author: Jacob Nielsen 
Date:   09-09-00 17:38

This is a simple script of how to paste users in this format:
no,username,realname,login

---
#!/bin/sh
echo -e "
`uptime`


`awk -F: '{print NR, $1, "[" $5 "]", $7 }' /etc/passwd`"
---

And another script for sending the above information to an email address:

--
#!/bin/sh
echo -e "
`uptime`


`awk -F: '{print NR, $1, "[" $5 "]", $7 }' /etc/passwd`" |mail -s "Use rs on `hostname`" someone@domain.com
echo "Ok, mail has been delivered..."
--

Hope its usable for someone, cause it is is for me :)

Cheers

Jacob Nielsen

Reply To This Message
 Forum List  |  Threaded View   Newer Topic  |  Older Topic 


 Forum List  |  Need a Login? Register Here 
 User Login
 User Name:
 Password:
 Remember my login:
   
 Forgot Your Password?
Enter your email address or user name below and a new password will be sent to the email address associated with your profile.
How to get the most out of the forum

phorum.org