- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: vi : can i execute a substitution at shell pro...
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
Forums
Discussions
Discussions
Discussions
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
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
10-31-2000 09:08 PM
10-31-2000 09:08 PM
#include
need to be changed to
#include
Can I kind of combine "find", "grep" and "vi"=>
:1,$s/string.h/String.h/g
to accomplish it?
Please help. Thank you.
Jessica
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2000 10:29 PM
10-31-2000 10:29 PM
SolutionPlease find attached the script which does the same thing what you wanted. I think this is the cleaner way than using vi to do the job.
Hope this helps.
PS: Use the Script as
# t.sh *.c
Enjoy !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2000 10:48 PM
10-31-2000 10:48 PM
Re: vi : can i execute a substitution at shell prompt?
re=string.h
sub_re=String.h
find your_dir -name "*.h" |
while read filename
do
ex -sc "1,$ s/$re/$sub_re/g | wq" $filename
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2000 09:23 AM
11-01-2000 09:23 AM
Re: vi : can i execute a substitution at shell prompt?
A small note to you. Use the script as
# t.sh *.c
You have to use "" to negate the what shell has about it.
......Madhu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2000 10:04 AM
11-01-2000 10:04 AM
Re: vi : can i execute a substitution at shell prompt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-01-2000 10:49 AM
11-01-2000 10:49 AM
Re: vi : can i execute a substitution at shell prompt?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2000 10:36 AM
11-02-2000 10:36 AM
Re: vi : can i execute a substitution at shell prompt?
Madhu's script uses 'sed,' which cannot modify the files directly, but uses an intermediate file to store the results before overwriting the original file. As an added safety net, you could modify his script so that the intermediate file is preserved (so you can verify the changes), and the original file is left untouched.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-02-2000 11:56 AM
11-02-2000 11:56 AM
Re: vi : can i execute a substitution at shell prompt?
......Madhu