- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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
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-03-2002 11:51 AM
07-03-2002 11:51 AM
Re: Some Tips & Tricks for "VI Editor"
:%g/
Sort the file
:%!sort
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 03:02 AM
07-04-2002 03:02 AM
Re: Some Tips & Tricks for "VI Editor"
Absolutely greate inputs.
Regards
Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 07:04 AM
07-04-2002 07:04 AM
Re: Some Tips & Tricks for "VI Editor"
1) To write to a file when you don't actually own it:
:w ! su root -c 'cat > %'
(This will prompt for root's password and allow you to overwrite the file)
2) To write to contents of a file to a shell command line (stepping through a large script for example)
:5,50w ! ksh -s
(The above example writes lines 5 through 50 to a korn shell
Additionally, you might be able to assign these to function keys depending on your system...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2002 07:12 PM
07-04-2002 07:12 PM
Re: Some Tips & Tricks for "VI Editor"
Really "vi" is very powerful "editor".
Once again, I thanks, everybody for their great contributions.
Please make this Question "vi - Tips & Tricks" of the forum, a single point of reference for "vi editor".
After the Bob's input, I feel there are so many powerful commands in vi.
So please continue your inputs and unhide the powerful features of "vi editor"
Regards
Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 02:28 AM
07-05-2002 02:28 AM
Re: Some Tips & Tricks for "VI Editor"
:1,$s/CTRL-V CTRL-M$//g
Carsten
In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- HhGttG
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2002 09:07 PM
07-05-2002 09:07 PM
Re: Some Tips & Tricks for "VI Editor"
How to ignore the case, while searching text.
e.g.
when I want to search say word "hp" in a file
/hp, it does not search for HP or Hp/hP.
Thanks & Regards
Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-06-2002 12:47 PM
07-06-2002 12:47 PM
Re: Some Tips & Tricks for "VI Editor"
to ignore case do:
:set ic
Do your search. If you want to set it back, do:
: setz noic
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2002 07:48 AM
07-10-2002 07:48 AM
Re: Some Tips & Tricks for "VI Editor"
:s/old/new/|s/abc/xyz/
to give two substitute commands.
:s/$/,/ 14
substiutes the last character with comma for 14 lines. Equivalent to :.,+13s/$/,/
:/kohli/-1 s/^/Father of Indian IT/
searches for Kohli (assuming you have :se ic) forward from you current line and the substitue command is executed on the line before it.
:/^Warning/;/^Warning d
deletes the second occurrence of the line starting with Warning. /^Warning/ ; // d gives the same result. Also
:12;/string/ is a valid address.
:1,$j
for joining all the lines.
:s/|/CTRL+V CTRL+M/g
substiutes the '|' with the newline character.
Hope this helps.
Thanks,
Chandrakumar
- « Previous
-
- 1
- 2
- Next »