02-13-2008
Yes, I know that's simple. I know how to get the name once I have a user id. My problem is I need to somehow scan thru the comma delimited user id list and retrieve one id at a time so that I can find the name in the passwd file.
My original command will give me the user login id list.
cat /etc/group|grep ^X:|cut -d: -f4
How do I scan thru this login id list, find the name for each of the ids, and print each id & name per line?
For example, the list of ids is ID1,ID2,ID3.
I want the report to show
ID1 John Doe
ID2 Jane Doe
ID3 John Smith
I hope this is clear. If not, let me know.
Thank you very much for your help.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hey
I'm writing a script that creates some processes,and some scripts which kill those processes.
the question is Simply:
How can I allow a group members to be able to kill (using kill command) processes created by other user at the same group?
and i need the change to be at the script... (5 Replies)
Discussion started by: The Dark Knight
5 Replies
2. AIX
Hey
I'm writing a script that creates some processes,and some scripts which kill those processes.
the question is Simply:
How can I allow group members to be able to kill processes created by other member at the same group?
I need your help as soon as possible
Thanks for your help in... (4 Replies)
Discussion started by: The Dark Knight
4 Replies
3. Shell Programming and Scripting
I need to find all the files that have group Read or Write permission or files that have user write permission.
This is what I have so far:
find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}'
It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies
4. Shell Programming and Scripting
get email notification from from system when a process from XXXX user takes longer than 15 min run.Let me know the time estimation for the same.
hi ,any one please tell me , how to write a script to get email notification from system when a process from as mentioned above a xxxx user takes... (1 Reply)
Discussion started by: kirankrishna3
1 Replies
5. Ubuntu
Hi,
Anyone can help me on how to duplicate privileges and group for useroradb01 to userrootdb01. I have currently using "useroradb01" and create a newly user "userrootdb01".
I want both in the sames privileges and group. Please see the existing users list below;
drwxr-xr-x 53 useroradb01... (0 Replies)
Discussion started by: fspalero
0 Replies
6. Shell Programming and Scripting
Hi,
I need an output of process running on server, i am executing
ps -ef | grep test
output is
asak 22362 1 0 Nov07 ? 00:00:03 /usr/software/bin/perl-5.8.8 /u/assk/bin/test -v none JOBID=2012117
asak 23748 22362 0 Nov07 ? 00:00:00 /usr/software/bin/perl-5.8.8... (3 Replies)
Discussion started by: asak
3 Replies
7. Red Hat
Hi,
In the following output you can see the the user "richard" is a member on the team/group "developers":
# id richard
uid=10247(richard) gid=100361(developers) groups=100361(developers),10053(testers)
but in the following details of the said group (developers), the said user... (3 Replies)
Discussion started by: indiansoil
3 Replies
8. Shell Programming and Scripting
Hi,
i need to list the processes running only under current logged in user.
EX:
$ whoami
oraaqw
$ ps -ef | grep tnslsnr
oraaqw 11403300 19267592 0 09:14:47 pts/3 0:00 grep tnslsnr
oraaqw 15794208 1 0 Jan 14 - 11:59... (6 Replies)
Discussion started by: aravindadla
6 Replies
9. Programming
Hi all ! :)
What I want?
1. All child process must be in the same group of process. Parent is a leader of the group.
How to do this? I would be greatfull of some example of code, I read about setsid but I can't even start...
My code so far:
#include <stdio.h>
#include <stdlib.h>... (2 Replies)
Discussion started by: mattdj
2 Replies
10. Shell Programming and Scripting
File examples
f17_mar_01_02_03_04_fsw1.xml
f17_mar_01_02_03_04_fsw2.xml
f17_mar_01_02_03_04_fsw3.xml
f17_feb_13_20_49_06_fsw1.xml
f17_feb_13_20_49_06_fsw2.xml
f17_feb_13_20_49_06_fsw3.xml
I have many xml files that are grouped with same file name, but are numbered from 1-to-many... (2 Replies)
Discussion started by: aachave1
2 Replies
LEARN ABOUT PHP
array_column
ARRAY_COLUMN(3) 1 ARRAY_COLUMN(3)
array_column - Return the values from a single column in the input array
SYNOPSIS
array array_column (array $array, mixed $column_key, [mixed $index_key = null])
DESCRIPTION
array_column(3) returns the values from a single column of the $array, identified by the $column_key. Optionally, you may provide an
$index_key to index the values in the returned array by the values from the $index_key column in the input array.
PARAMETERS
o $array
- A multi-dimensional array (record set) from which to pull a column of values.
o $column_key
- The column of values to return. This value may be the integer key of the column you wish to retrieve, or it may be the string
key name for an associative array. It may also be NULL to return complete arrays (useful together with $index_key to reindex the
array).
o $index_key
- The column to use as the index/keys for the returned array. This value may be the integer key of the column, or it may be the
string key name.
RETURN VALUES
Returns an array of values representing a single column from the input array.
EXAMPLES
Example #1
Get column of first names from recordset
<?php
// Array representing a possible record set returned from a database
$records = array(
array(
'id' => 2135,
'first_name' => 'John',
'last_name' => 'Doe',
),
array(
'id' => 3245,
'first_name' => 'Sally',
'last_name' => 'Smith',
),
array(
'id' => 5342,
'first_name' => 'Jane',
'last_name' => 'Jones',
),
array(
'id' => 5623,
'first_name' => 'Peter',
'last_name' => 'Doe',
)
);
$first_names = array_column($records, 'first_name');
print_r($first_names);
?>
The above example will output:
Array
(
[0] => John
[1] => Sally
[2] => Jane
[3] => Peter
)
Example #2
Get column of last names from recordset, indexed by the "id" column
<?php
// Using the $records array from Example #1
$last_names = array_column($records, 'last_name', 'id');
print_r($last_names);
?>
The above example will output:
Array
(
[2135] => Doe
[3245] => Smith
[5342] => Jones
[5623] => Doe
)
PHP Documentation Group ARRAY_COLUMN(3)