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?
AIX25Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

woolmilkporcCommented:
OK,

I assume that you're aware that it's basically this:

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

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

But what do you mean wth "neatly"?

As you know, "lsuser" and "groups" produce quite a lot of output.

Which attributes do you need? How should the resulting ouput look like?

You could try "lsuser -c" which produces colon-separated output suitable for MS-Excel.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AIX25Author Commented:
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?
0
ozoCommented:
What do you mean by run against?
Do you mean something like this?
xargs xargs -n 1 groups < flat_file
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

AIX25Author Commented:
Thank you the previous command you gave me worked. It was a typo on my end. Thanks!
0
woolmilkporcCommented:
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

?
0
AIX25Author Commented:
yes, flat file has one user per line.

It worked...was a typo on my end.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.