ID - output group-memberships one per line


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ID - output group-memberships one per line
# 1  
Old 12-19-2011
[SOLVED] ID - output group-memberships one per line

Hello,

I am currently a little bit lost with my new shell-script.
I am trying to output the results of the "id"-command as a "one per line" statement. For example:
I have the user "test" with the group-memberships "group1, group2, group3". When I enter "id test" it will show me the output "uid=222(test) gid=223(group1) groups=223(group1), 224(group2), 225(group3)". What I want to achieve is to output the results as
uid=222(test)
gid=223(group1)
groups=223(group1)
224(group2)
225(group3)

I want to achieve this because I want to insert the group-names into an array and continue to work with this array. I am stuck at this point, I am so far that I can output one group and only the name of that group with the help of awk - but I don't know how to go further from this point.
Can anyone pinpoint me into the right direction?


Your help is greatly appreciated, thanks in advance
Thomas

Last edited by henryford; 12-19-2011 at 09:47 AM.. Reason: Solved.
# 2  
Old 12-19-2011
Try piping it into tr " ," "\n".
This User Gave Thanks to CarloM For This Post:
# 3  
Old 12-19-2011
Wow - that was fast, and it works too Smilie
Thank you very much!
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies

2. Shell Programming and Scripting

Joining multi-line output to a single line in a group

Hi, My Oracle query is returing below o/p ---------------------------------------------------------- Ins trnas value a lkp1 x a lkp1 y b lkp1 a b lkp2 x b lkp2 y ... (7 Replies)
Discussion started by: gvk25
7 Replies

3. Shell Programming and Scripting

How to group the output w/ limit

Hi All, Second time to post on this group :) I'm pulling my hair now 'coz I'm so dumb to produce this requirement. Requirement: I want to run a utility by limiting the no. inside my process (mov##) to be able to use in multi streaming. Here is my script: --Input: "user_list.txt"... (0 Replies)
Discussion started by: alvingo
0 Replies

4. Shell Programming and Scripting

How to group the output of a loop

Hi Guys, This is based on my question previously posted. :) I have my shell script like this: #!/usr/bin/sh e_id=`sqlplus -s scott/tiger@DB<<eof SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF; select emp_id from employee; quit ... (1 Reply)
Discussion started by: alvingo
1 Replies

5. Shell Programming and Scripting

Group the output of the variable

Hi Guys, First time in scripting & first time here...:D I need help in this situation - My requirements is: I have a list e.g. list=`echo ls -l *` OR list=`sql.... select emp_id from employee ...` The Input is: ls -l OR emp_id A 4567 B 2231 C ... (2 Replies)
Discussion started by: alvingo
2 Replies

6. UNIX for Dummies Questions & Answers

output of file from several machines written to network share, then emailed to group.

I have a script on all the machines on my network that lists how many updates are available for each machine, and then outputs the answer to a file called updates.txt the output shows the hostname and the number of updates, like: computer_A 7 I want all these machines to output the data to... (1 Reply)
Discussion started by: glev2005
1 Replies

7. Shell Programming and Scripting

awk help required to group output and print a part of group line and original line

Hi, Need awk help to group and print lines to format the output as shown below INPUT FORMAT set echo on set heading on set spool on /* SCHEMA1 */ CREATE TABLE T1; /* SCHEMA1 */ CREATE TABLE T2; /* SCHEMA1 */ CREATE TABLE T3; /* SCHEMA1 */ CREATE TABLE T4; /* SCHEMA1 */ CREATE TABLE T5;... (5 Replies)
Discussion started by: rajan_san
5 Replies

8. Shell Programming and Scripting

how to make a line BLINKING in output and also how to increase font size in output

how to make a line BLINKING in output and also how to increase font size in output suppose in run a.sh script inside echo "hello world " i want that this should blink in the output and also the font size of hello world should be big .. could you please help me out in this (3 Replies)
Discussion started by: mail2sant
3 Replies

9. UNIX for Dummies Questions & Answers

How can I better group my output?

I have a script that puts out a list that looks like this: bb1 newyork bb1 pittsburg bb2 seattle bb2 spokane sl1 sacramento I want to seperate the output so that it instead has a space between each group so like this: bb1 newyork bb1 pittsburg bb2 seattle bb2 spokane sl1... (8 Replies)
Discussion started by: llsmr777
8 Replies
Login or Register to Ask a Question