From: Shawn Bierman (BiermanS@METHODISTHEALTH.ORG)
Date: Wed Oct 15 2003 - 16:02:42 EDT
This will get a list of all users on the system with the 'lsuser' command. It will then find their home directories with the 'lsuser' command. Then scan those home directories .profile's and search for the string "export TBL_LOG=T1". If it finds it it will append it to the logfile. It also notes the username associated with the home directory.
change the $LOGFILE variable to something appropriate to your environment.
-shawn
¯--------CUT--------------
#!/bin/sh
LOGFILE=/home/biermans/logfile.test
> $LOGFILE
for user in `/usr/sbin/lsuser -a id ALL | /usr/bin/cut -d' ' -f1`
do
echo $user
cd `/usr/sbin/lsuser -a home $user | /usr/bin/cut -d'=' -f2` 1>/dev/null 2>/dev/null
RESPONSE=`/usr/bin/grep 'export TBL_LOG=T1' .profile`
if [[ ! -z $RESPONSE ]]; then
echo "$user: \c" >> $LOGFILE
echo $RESPONSE >> $LOGFILE
fi
done
¯-------CUT--------------
>>> vkhushu@GUERNSEYOP.COM 10/15/03 11:57:02 AM >>>
Does anyone have a way to extract into a text file a particular line from
the .profile of a user and then show that the line extracted belongs to the
user from whose .profile the line was extracted.
For example,
# cd ALISONS
# ls
.profile fax
# more .profile
export TBL_LOG=T1 <<<< this is the line I need to extract then correlate
it to ALISONS
export TERM=vt100
...
...
...
exit
TIA
Vipin
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:16 EDT