- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- search 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
тАО10-27-2010 05:16 PM
тАО10-27-2010 05:16 PM
i have seen many search and replace posts.. but this issue i am not seeing..
1. in vi editor how to control the search and replace only in first 50 lines or from curser the next 50 lines or between line numbers 20 to 70?
2. i am having a string
OBJECT "<$1>"
OBJECT "NT"
OBJECT "NT_OS"
like these...
i would like to search for OBJECT "NT* and replace them with OBJECT "abc$1"
or OBJECT "N<> ---i want to search for string starting with N and it should have only x number of characters...so that i can control, whether NT or NT_OS will get replaced.
thanks...
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2010 06:30 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2010 12:37 AM
тАО10-28-2010 12:37 AM
Re: search and replace
If you only have two choices, you can just limit it with \< and or \>
:s/NT\>/abc$1/
>Kapil: to replace something from line 20 to 70
If you don't want line numbers, you can change from one mark to another:
:'a,'bs/abc/pqr/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2010 01:55 AM
тАО10-28-2010 01:55 AM
Re: search and replace
one more question:
how to search for a string and replace its whole line(with confirmation)?
i mean,
:%s/OBJECT*/OBJECT "NT"/gc
OBJECT* -- i wanted to search for the line OBJECT "_ _ _ _ ..." and replace it with OBJECT "NT"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2010 09:32 PM
тАО10-28-2010 09:32 PM
Re: search and replace
1. in vi editor how to control the search and replace only in first 50 lines or from curser the next 50 lines or between line numbers 20 to 70?
:1,50s/
:20,70s/
This will replace only the first occurance of the pattern in the given line. To replace all occurances of
:1,50s/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-28-2010 09:38 PM
тАО10-28-2010 09:38 PM
Re: search and replace
:%s/OBJECT.*/OBJECT "NT"/gc