I have a text files with a list of users formatted like:name1   name2   name3   ...Calling the command groups gives the primary group name for that user. ex:bash$ groups name1name1: group_NameI want to get the groups of all the users of the textfile and put this list of groups into a new text file.  Does anyone know a command for this? Maybe a script the iterates the first file with the names and calls groups on each name then stores the output in a new file. I just need a little help with the specifics.
Getting Group Names for List of Users
shell script;text processing;users;group
Read the file line by line, call groups for each item:while read name ; do groups $name ; done < list.txt > with_groups.txtLoops can often be replaced by xargs:xargs groups < list.txt > with_groups.txt