Link to home
Start Free TrialLog in
Avatar of AIX25
AIX25Flag for United States of America

asked on

AIX - Command against flat file

I have a flat file with a list of users. I want to be able to run lsuser or groups command against the list of users in my flat file and output it to a file (neatly of course). Can someone help?
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AIX25

ASKER

It did not work correctly.

while read user;
  do
    groups $user
  done  < flat_file > output_file

It only outputted the user's primary group.

Also, when I ran the scrip it displayed "stty: standard input: A specified file does not support the ioctl system call."

How do I get it to provide the output every group for the user?
What do you mean by run against?
Do you mean something like this?
xargs xargs -n 1 groups < flat_file
Avatar of AIX25

ASKER

Thank you the previous command you gave me worked. It was a typo on my end. Thanks!
What does flat_file contain? Should be one user per line and you should avoid empty lines.

"groups" always displays all groups of a user.

What do you see with

groups root

?
Avatar of AIX25

ASKER

yes, flat file has one user per line.

It worked...was a typo on my end.