- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Needs vi editor tips
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
09-25-2000 12:57 AM
09-25-2000 12:57 AM
Needs vi editor tips
I'm suffering from vi command.
I know the '.' character redo the previous command in editing mode.
How can I apply this redo command for several lines in one command?
for example, I modify number 3 line and I want apply this from 20 to 50 line.
How can I do this?
Hope to get your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 01:09 AM
09-25-2000 01:09 AM
Re: Needs vi editor tips
Goto line 20 by doing :20
Then to repeat your command for the next 30 lines (from 20-50) you can supply a count to . eg. 30.
This should repeat your command for the next 30 lines. Tested it, works fine. you may need to go to line 20 first, do your command for the first line, then do 29.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 05:08 AM
09-25-2000 05:08 AM
Re: Needs vi editor tips
In the vi command mode, do the following:
:20,50 s/oldpattern/newpattern/
The above is saying on lines 20 - 50, do a substitute command from the oldpattern to the newpattern.
As always, if you are testing some new editor functions, make a backup copy of the file before you do the experiments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 08:26 AM
09-25-2000 08:26 AM
Re: Needs vi editor tips
You can also use the :map feature of ex to make a single key map to a long sequence of keys. For example,
:map #1 cwnew^V^[/old^V^M
would make the F1 key change a world to "new", then search for an occurance of "old". The escape and carriage return characters are quoted with a control-V character. You can map normal characters, function keys, or characters typed with control or alt combinations. Almost all of the normal characters are already used by some vi binding.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 09:32 AM
09-25-2000 09:32 AM
Re: Needs vi editor tips
set nu
set showmode
Log out and login, then try the steps contributed by your peers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2000 09:36 PM
09-25-2000 09:36 PM
Re: Needs vi editor tips
The command to redo the last 'ex' command is '&'.
For example, you type
:s/oldpat/newpat/
and want to re-apply the same change to line 20-50, type
:20,50&
This should do the trick.
Bye,
Rik.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-27-2000 09:24 AM
09-27-2000 09:24 AM
Re: Needs vi editor tips
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2000 03:52 AM
09-28-2000 03:52 AM
Re: Needs vi editor tips
vi is capable to execute macros too.
See man vi and search for @buffer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2000 04:04 AM
09-28-2000 04:04 AM