- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Find and Replace
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 01:28 PM
тАО11-11-2009 01:28 PM
I have hundreds of files that I need to change the ownerships for. The files are under directory
-rw-rw---- 1 4707 arbor 570 Oct 29 20:03 /opt/hyperion/parmfiles/arbor/ECSDM_INCFC_CCHD_CRNCY_CONV_RATE
I need to change the files owned by UID 4707 to arbor. I was thinking of using for loop.
Any help would be appreciated.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 01:31 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 01:50 PM
тАО11-11-2009 01:50 PM
Re: Find and Replace
2 steps required
1st
#cd /opt/hyperion/parmfiles/arbor/ECSDM_INCFC_CCHD_CRNCY_CONV_RATE
2nd
#find . -type f -user 4707 -exec chown arbor {} \;
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 01:58 PM
тАО11-11-2009 01:58 PM
Re: Find and Replace
Patrick's use of the "+" terminator with the '-exec' command makes things much more efficient than if the '\;' terminator is used.
That is:
# find . -type f -user 4707 -exec chown arbor {} \+
...runs much faster than:
# find . -type f -user 4707 -exec chown arbor {} \;
The '+' syntax causes multiple arguments to be assembled and passed to one instantiation of the 'exec'ed command eliminating the overhead of spawning one process per file.
Lastly, too, you do not need to escape the '+' character and can write:
# find . -type f -user 4707 -exec chown arbor {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-11-2009 02:29 PM
тАО11-11-2009 02:29 PM
Re: Find and Replace
True. Old habits die hard though.