- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Some Tips & Tricks for "VI Editor"
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
тАО07-01-2002 06:03 AM
тАО07-01-2002 06:03 AM
Re: Some Tips & Tricks for "VI Editor"
:= show how many lines in the file.
HP has a book "The Ultimate guide to the VI and EX Text Editors" that will tell you everything you ever want to know about vi.
HTH
Marty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 06:05 AM
тАО07-01-2002 06:05 AM
Re: Some Tips & Tricks for "VI Editor"
:r filename
to insert the contents of the specified file into the current file you are editing. I use this alot to add headers and standard env setups to my scripts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 12:42 PM
тАО07-01-2002 12:42 PM
Re: Some Tips & Tricks for "VI Editor"
VVVV IMP to open a large files
[
vi
:set dir=/
:e
]
so that you have to set the largefilesystem with enough space of your largefile....so vi default searches for /var/tmp....if it doesnt have enought space of your largefile....
it wont open it completely and if you save it accidentally....it will be a problem
take care
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 01:21 PM
тАО07-01-2002 01:21 PM
Re: Some Tips & Tricks for "VI Editor"
sed '1,3y/abcde/ABCDE/' filename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 01:44 PM
тАО07-01-2002 01:44 PM
Re: Some Tips & Tricks for "VI Editor"
/1G
Last line in the file:
/G
Search for a string or number etc..:
/keyword_that_you_want_to_search_for
n (to repeat the last find forward)
N (to repeat the last find backward)
Take me to the end of the line and put me in insert mode so I can add text:
A
All of the responses were great but I find that these are the most used, plus search and replace already given to you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 05:19 PM
тАО07-01-2002 05:19 PM
Re: Some Tips & Tricks for "VI Editor"
http://www.talug.org/minutes/19990310/lesson/lesson.html
http://computips.virtualave.net/tips/vi_commands.html
http://www.roxanne.org/vi.html
How many of us have done this:
ls -l /somedir > /tmp/dirlst.txt
then
vi /tmp/dirlst.txt
when we could have done this
vi /tmp/dirlst.txt
!!ls -l /somedir
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 07:16 PM
тАО07-01-2002 07:16 PM
Re: Some Tips & Tricks for "VI Editor"
Ans: xp
2. if you want opn a last line of file
Ans: vi + /var/adm/syslog/syslog.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 07:47 PM
тАО07-01-2002 07:47 PM
Re: Some Tips & Tricks for "VI Editor"
:%s/old/new/gc
Where the g is global and the c is confirm before commit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 08:09 PM
тАО07-01-2002 08:09 PM
Re: Some Tips & Tricks for "VI Editor"
:! /usr/bin/cal [arg]
of course that will work with any shell command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-01-2002 11:48 PM
тАО07-01-2002 11:48 PM
Re: Some Tips & Tricks for "VI Editor"
I guess one could fill a whole book with cute little vi tricks.
Here are some things I appreceate with vi.
Maybe they have already been addressed?
Shell escapes are a really nice feature (but sometimes dreaded by paranoid sysadmins ;-)
You have already seen the bang of the ex commands
:! ll /var/adm
But what I think has been missed is the combination with ex's read command.
How about dumping the output of a command in your current vi buffer?
:r! ll /var/adm
This come really handy to me, when I am too lazy to type endless paths to commands that usually don't reside under /usr/bin
:r! which perl
Then you can escape to the shell without leaving your vi session when you have several commands to issue
:sh
After your commands type exit to get back to your vi session.
Have you already discovered the power of mappings?
Edit your .exrc file, and insert a mapping like this:
(This is to insert a standard Perl header when pressing the F1 key)
map ^[[001q :r!which perl^M^[I#!^[A -w^M^Muse strict;^M^M
You get the control characters when you typ Ctrl+v (or C^V) together, which quotes the next key.