Script to run #groups command on list in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to run #groups command on list in a file
# 8  
Old 06-28-2019
@RudiC

That was perfect. I just had to insert the variable identifier $ in front of (hostname) in the command. I even was able to redirect it to my file.

THANK YOU

--- Post updated at 06:02 PM ---

@RudiC

That was exactly the short command I needed. I did have to add a variable indicator $ in front of the (hostname) in the command, but the output is perfect.

THANK YOU.
# 9  
Old 06-29-2019
Code:
groups $(< $(hostname)_unlist.txt)

In theory the groups command can overflow with "two many arguments".

The xargs command can avoid it, would rather start another groups command with the remaining arguments.
Code:
xargs groups < $(hostname)_unlist.txt

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Python script to run multiple command and append data in output csv file

Experts, I am writing a script and able to write only small piece of code and not able to collect logic to complete this task. In input file have to look for name like like this (BGL_HSR_901_1AG_A_CR9KTR10) before sh iss neors. Record this (BGL_HSR_901_1AG_A_CR9KTR10) in csv file Now have to... (0 Replies)
Discussion started by: as7951
0 Replies

2. Shell Programming and Scripting

Shell script run in a case statement call to run a php file, also Perl

Linux System having all Perl, Python, PHP (and Ruby) installed From a Shell script, can call a Perl, Python, PHP (or Ruby ?) file eg eg a Shell script run in a case statement call to run a php file, also Perl or/and Python file??? Like #!/usr/bin/bash .... .... case $INPUT_STRING... (1 Reply)
Discussion started by: hoyanet
1 Replies

3. Shell Programming and Scripting

Script to read through a file and create new users/assign them to groups in Ubuntu

Hi all. I need a shell script that can, in short, read through a text file line by line and create a new user in Ubuntu, as well as assign that user to a group. The format of the text file is not important but preferably: 'username:group'. I don't have much programming knowledge no matter shell... (3 Replies)
Discussion started by: LewisWeekly
3 Replies

4. UNIX for Dummies Questions & Answers

Read workstation list from file und run command

Hi, how do I read in a file which includes a list of workstations and then run a command for each workstation ? I am unclear which command to use to read in , or is this not possible ? Thanks, (3 Replies)
Discussion started by: manni2
3 Replies

5. Shell Programming and Scripting

Script for telnet and run one command kill it and run another command using while loop

( sleep 3 echo ${LOGIN} sleep 2 echo ${PSWD} sleep 2 while read line do echo "$line" PID=$? sleep 2 kill -9 $PID done < temp sleep 5 echo "exit" ) | telnet ${HOST} while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies

6. Shell Programming and Scripting

Urgent...Need a shell script to list files which belong to particular groups

Hi, I am just new to scripting but got to write a complex scipt please help. i need a shell script which can check the list of data listed in a txt doc and see if they belong to any of the groups that are listed in other list file.... (5 Replies)
Discussion started by: draghun9
5 Replies

7. Shell Programming and Scripting

how to run an already made script run against a list of ip addresses solaris 8 question

how to run an already developed script run against a list of ip addresses solaris 8 question. the script goes away and check traffic information, for example check_GE-VLANStats-P3 1.1.1.1 and returns the results ok. how do I run this against an ip list? i.e a list of 30 ip addresses (26 Replies)
Discussion started by: llcooljatt
26 Replies

8. Shell Programming and Scripting

Script to run command against multiple specific value in one file

Hi all, I am trying to create a shell script from solaris 10 server to run a command into multiple specific value in one file. The command is related to Oracle/Sun JES2005Q4 directory server. #this is the command, #from path /jes/ds/slapd-rldap1 ./ns-inactivate.pl -h mldap1 -p 389 -D... (12 Replies)
Discussion started by: Mr_47
12 Replies

9. Shell Programming and Scripting

Run SQL command for a list of devices

Hi Please help me to resolve. Question: I can run this command to change the mode of a device with id=500 as below dbc "select device mode=3 where id=500;" How can i run the same query with a file contaning n number of ids ? file1.txt 12 234 34 500 34 45 Thanks in... (3 Replies)
Discussion started by: sureshcisco
3 Replies

10. Shell Programming and Scripting

script to run shell command and insert results to existing xml file

Hi. Thanks for any help with this. I'm not new to programming but I am new to shell programming. I need a script that will 1. execute 'df -k' and return the volume names with specific text 2. surround each line of the above results in opening and closing xml tags 3. insert the results of step... (5 Replies)
Discussion started by: littlejon
5 Replies
Login or Register to Ask a Question