AIX/Linux - UID find and replace

I have an issue where we migrate users over with their data they own but end up with a different UID from the source platform to the target platform. Is there a way to cd into a specific directory and do a find on a specific UID and replace it with a specific username that I want to assign?
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.

cd /directory
find . -user 999 | xargs chown username
Please note that I'm not at my office (I'm on mobile right now) so I can't respond as fast as usual.
AIX25Author Commented:
I tried this and it fails to find certain directories and files because of spaces and slashes. Can you help modify the commanded you provided above and to factor in spaces and slashes?
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

Does this work? Sorry, I can't test it right now!

find . -user 999 -exec chown username "{}" \;
Now that I can again access my machines I tested the above and found that  it  works.

This will work, too:

find . -user 999 | xargs -I{} chown username {}
AIX25Author Commented:
I'm using this one, find . -user 999 -exec chown username "{}" \;
At times I would like to change the group ownership that possible to add that piece to it?
You have all options you desire.

1) Search for numeric userid and change group and owner

find . -user 999 -exec chown username:groupname "{}" \;

2) Search for numeric userid and change just the group

find . -user 999 -exec chgrp groupname "{}" \;

3) Search for numeric group id and change owner and group

find . -group 999 -exec chown username:groupname "{}" \;

4) Search for numeric group id and change just the group

find . -group 999 -exec chgrp groupname "{}" \;


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
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.