In unix, how can I pipe the output of who into the groups command?
I'm trying to do something like this:
Say there are 4 users logged into a UNIX machine, a, b, c, and d.
Now, to get the groups these guys belong to, I have to type out :
groups a b c d.
What I am wondering, is if there is a way to do something like who | groups where I can pipe the users currently logged-in to the groups command, which would then print out all the users given along with their group information. However, this does not seem to work as intended - rather, the above command just gives the group the first user belongs to.
Copyright License: Author:「waffles」,Reproduced under the CC 4.0 BY-SA copyright license with link to original source & disclaimer. Link to:https://stackoverflow.com/questions/3877831/in-unix-how-can-i-pipe-the-output-of-who-into-the-groups-command
About “In unix, how can I pipe the output of who into the groups command?” questions
I'm trying to do something like this:
Say there are 4 users logged into a UNIX machine, a, b, c, and d.
Now, to get the groups these guys belong to, I have to type out :
groups a b c d.
What I am
|
I am working with an idea using the unix who command. As we all know, there does not seem to be a direct switch that gives just the username and line (terminal) info without the date and screen in...
|
I'm trying to utilize the STDIN construct with Julia to read in the output of a unix command:
#!/usr/bin/julia
readline(STDIN)
Then in my terminal:
$ cat myfile.txt | ./pipe.jl
but I am not get...
|
This is probably a dup (but did not find it..)
When you type ls -l in unix you get output like this:
% ls -l
total 48
-rwxr--r-- ... change*
-rwxrwxrwx ... checkVersion*
-rwx------ ... info...
|
I need to extract the group names from Unix id command output. I tried but could not write the regex. Sample output of id command is:
uid=xxxxxx(amit) gid=xxxxxxx(xxxxxx) groups=xx(xxxx),xxxxxx(x...
|
I am creating a C program and with it I am setting up a pipe between separately forked process for interprocess communication.
The first process has written the data I need into the pipe.
However,
|
Right now I'm using another text file to store the result of one UNIX command and then using that file to run another command, like so:
tr -d "[,|.]" < text > temporary.txt
tr "[A-Z]" "[a-z]...
|
I have this C function that I am using to output any amount of integer that is input.
/*
This program will be called function.c
*/
#include <stdio.h>
int main (void) {
int num;
wh...
|
In MySql -e option prints different formatting when used the output with pipe.
Without Pipe
[root@localhost commands]# $MYSQL_CONNECT_STR -e 'select 0/8'
+--------+
| 0/8 |
+--------+
| 0.
|
The below "one liner" explains what I'm trying to do:
pbpaste > ~/Documents/convertme.txt; \
dos2unix -c mac ~/Documents/convertme.txt && \
cat ~/Documents/convertme.txt | pbcopy &&...
|
|
|