The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Invitation to join the UNIX Forums Users Group on LinkedIn Neo What's on Your Mind? 1 06-05-2008 12:30 PM
UNIX Forums Users Group - LinkedIn ? Bobby Post Here to Contact Site Administrators and Moderators 4 11-20-2007 02:03 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-24-2003
afiore afiore is offline
Registered User
  
 

Join Date: Jun 2003
Posts: 1
AIX Unix.. number of users on system in a particular group

Does anyone know what pipe string might be used to determine how many people are logged onto an AIX system where a group ID begins with lets say 4.

In other words, I am looking to query the system for the number of people currently logged onto a system that belong to any group starting with 4. Could be 400, 4102, 444, etc.
  #2 (permalink)  
Old 06-26-2003
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
This will give you a list of users and gid starting with 4 - modify it for your needs ( sorry it's what I use to write scripts in).

Code:
#!/bin/csh
set allusers="`who -q`"
foreach xx ($allusers)
        if ("$xx" == "#") then
                 exit
        else
                # find info on user
                set mygid=`grep $xx /etc/passwd|awk -F: '{print $4}'`
                if ("$mygid" != "") then
                set first=`echo $mygid|awk '{print substr($0,0,1)}'`
                        if ("$first" == "4") then
                                # let me know who
                                echo $xx"  "$mygid
                        endif
                endif
        endif
end
Also note it will only give you folks that are in the password file - if you're using NIS, you would have to change where it's looking.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 08:58 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0