Quote:
Originally Posted by bonnydeal
Checkout the man pages for wc - that should do it.
Code:
ypcat group |grep zebra1 | wc -l
|
Note that
-l option counts lines, not words or columns. Since output of
ypcat group... command is one liner, so there's no point of using
-l option, but instead there should be used
-w (it stands for words count, check man page of
wc). However, you should try some utility like
awk to count all users in a group. Just give it a try:
Code:
~$ awk -F"," '/zebra1/ {gsub(","," ",$0); print $0}' /etc/group | wc -w