- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- vi question
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
07-25-2003 10:59 AM
07-25-2003 10:59 AM
vi question
Is there any easy way to replace bunch of word in file in vi mode. For example in a file i have strings as "x123" ,"y123" ,"4123" etc.
I would like to change these strings as "0123".Please help.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:03 AM
07-25-2003 11:03 AM
Re: vi question
Try this:
:%s/.123/0123/g
JP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:04 AM
07-25-2003 11:04 AM
Re: vi question
for Ex: if you want to replace x123 as 0123 use this way
:1,$s/x123/0123/g
-USA...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:05 AM
07-25-2003 11:05 AM
Re: vi question
sed 's/*123/0123/g' filename
I think that will do it.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:06 AM
07-25-2003 11:06 AM
Re: vi question
:1,$s/[1-9a-zA-Z]123/0123/g
The above will replace any string that starts with a number other than 0 or an upper or lower case letter followed by 123 (1123,a123,D123, etc) with 0123 and will do it for all occurrences.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:07 AM
07-25-2003 11:07 AM
Re: vi question
:/.123/s//0123/g
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:09 AM
07-25-2003 11:09 AM
Re: vi question
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:21 AM
07-25-2003 11:21 AM
Re: vi question
Makes it a bit easier.
Its pretty wasy to read code.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:26 AM
07-25-2003 11:26 AM
Re: vi question
Try this:
:1,$s/OLD STRING/NEW STRING/g
Caesar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2003 11:53 AM
07-25-2003 11:53 AM
Re: vi question
I have tried your suggetions.Really Really
I'm happy since it worked like anything.
Thanks for the useful quick reply.