Fedora Linux Support Community & Resources Center
  #1  
Old 27th April 2010, 07:40 AM
youralibaba Offline
Registered User
 
Join Date: Apr 2010
Posts: 5
linuxfirefox
Lightbulb how to count the user ID in passwd file ?

I want to write a script to count the # of regular users (ID > 1000) and special users(ID >1 <100) in linux.

#! /bin/bash

cat /etc/passwd | cut -f3 -d':' | wc -w

plz correct the script.
Reply With Quote
  #2  
Old 27th April 2010, 09:42 AM
giulix's Avatar
giulix Offline
"Fixed" by (vague) request
 
Join Date: Oct 2005
Location: GMT+ 1
Posts: 2,950
linuxfedorafirefox
Re: how to count the user ID in passwd file ?

Code:
cat /etc/passwd |awk -F ":" '{if($3 < 1000) A++ ; else B++} END {print "<1000="A"; >1000="B}'
Reply With Quote
Reply

Tags
count, file, passwd, user

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use PAM to authenticate a user where the passwd is on another machine? ccy Using Fedora 1 2nd January 2007 12:13 PM
content of passwd file kuul Using Fedora 5 12th July 2006 08:55 AM
Importing passwd file nivis Using Fedora 0 21st September 2005 10:31 PM


Current GMT-time: 12:12 (Thursday, 20-06-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat