Bob Beers wrote:
grep group_name: /etc/group | cut -d: -f4
will give a comma separated list, provided group_name is a valid group name.
There is one problem with this approach, which is the assumption that
all users' primary group is the same as their login id - which I agree
is typically
Part 1:
On Tue, Sep 23, 2008 at 7:37 PM, Ian Blackwell [EMAIL PROTECTED] wrote:
Bob Beers wrote:
grep group_name: /etc/group | cut -d: -f4
will give a comma separated list, provided group_name is a valid group
name.
There is one problem with this approach, which is the assumption that
Bob Beers wrote:
Part 1:
You have a valid point, but the OP's question was:
I am looking for a (simple) shell command to run from a bash script
that will allow me to list user accounts that belong to a particular
group.
In all likelihood the system follows the default approach of
I have several shell scripts to manage user accounts on a server. I've
been using a file with the usernames of peoples accounts that any script
needs to process. I had a thought that I can and should be setting up
groups and adding user accounts to those groups so I don't have to
maintain a
Quoting Tim Alberts [EMAIL PROTECTED]:
I have several shell scripts to manage user accounts on a server. I've
been using a file with the usernames of peoples accounts that any script
needs to process. I had a thought that I can and should be setting up
groups and adding user accounts to
On Tue, Sep 23, 2008 at 1:31 PM, Tim Alberts [EMAIL PROTECTED] wrote:
So essentially, I am looking for a (simple) shell command to run from a bash
script that will allow me to list user accounts that belong to a particular
group. Any help is appreciated.
grep group_name: /etc/group | cut -d:
Barry Brimer wrote:
With spaces separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/ /g'
With commas separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }'
I'm sorry, I didn't specify, I'm using LDAP for user/group management.
On Tue, Sep 23, 2008 at 7:11 PM, Tim Alberts [EMAIL PROTECTED] wrote:
Barry Brimer wrote:
With spaces separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
/g'
With commas separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4
Quoting Tim Alberts [EMAIL PROTECTED]:
Barry Brimer wrote:
With spaces separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
/g'
With commas separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }'
I'm sorry, I didn't
On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote:
Quoting Tim Alberts [EMAIL PROTECTED]:
Barry Brimer wrote:
With spaces separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
/g'
With commas separating groups:
egrep -e
Bob Beers wrote:
On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote:
With commas separating groups:
getent group | egrep -i '^groupname:' | awk -F : '{ print $4}'
With spaces separating groups:
getent group | egrep -i '^groupname:' | awk -F : '{ print $4}' | sed -e
On Tue, 23 Sep 2008, Bob Beers wrote:
On Tue, Sep 23, 2008 at 7:26 PM, Barry Brimer [EMAIL PROTECTED] wrote:
Quoting Tim Alberts [EMAIL PROTECTED]:
Barry Brimer wrote:
With spaces separating groups:
egrep -e '^groupname:' /etc/group | awk -F : '{ print $4 }' | sed -e 's/,/
/g'
With
On Tue, Sep 23, 2008 at 6:43 PM, Barry Brimer [EMAIL PROTECTED] wrote:
The egrep is using a leading anchor (^) to make sure the grep matches the
beginning of the line. If not, and the group pattern matched as one of the
users it would print those lines too .. which is probably undesirable.
13 matches
Mail list logo