- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep for string and change in a whole director...
Operating System - HP-UX
1825001
Members
2491
Online
109678
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО01-06-2005 04:07 AM
тАО01-06-2005 04:07 AM
I need to set up alittle script ( I am rearranging my directory structure ) that searches thru a directory and changes any /home/test/pub strings in my files to ... /home/test/foo/moo
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2005 04:18 AM
тАО01-06-2005 04:18 AM
Solution
Try-
cd /directory
perl -ipe 's{/home/test/pub}{/home/test/foo/moo}g;' *
perl has a facility to do in place updating, where each file will be changed and the result will be put back in the original file.
HTH
-- Rod Hills
cd /directory
perl -ipe 's{/home/test/pub}{/home/test/foo/moo}g;' *
perl has a facility to do in place updating, where each file will be changed and the result will be put back in the original file.
HTH
-- Rod Hills
There be dragons...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2005 04:27 AM
тАО01-06-2005 04:27 AM
Re: grep for string and change in a whole directory
Hi,
If you want to do this for every file including files in the subdirectories, then try,
find /source_dir -type f -exec sed 's/\/home\/test\/pub/\/home\/test\/foo\/moo/g' {} \;
Hope this helps.
Regds
If you want to do this for every file including files in the subdirectories, then try,
find /source_dir -type f -exec sed 's/\/home\/test\/pub/\/home\/test\/foo\/moo/g' {} \;
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-06-2005 04:46 AM
тАО01-06-2005 04:46 AM
Re: grep for string and change in a whole directory
Perl works great!
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP