HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: editing between two files in vi
Operating System - HP-UX
1833738
Members
2386
Online
110063
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
05-27-2003 01:17 PM
05-27-2003 01:17 PM
I want to make editing between two, or more files in vi, how do I do
that? ex, I want to yank a line in file1 and paste it into another file withing the same vi editor.
Has to be able to switch back and forth between these files without
getting
out of vi.
Thanks in advance!
zhou
that? ex, I want to yank a line in file1 and paste it into another file withing the same vi editor.
Has to be able to switch back and forth between these files without
getting
out of vi.
Thanks in advance!
zhou
none
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2003 01:28 PM
05-27-2003 01:28 PM
Re: editing between two files in vi
why not just open up two hpterms with a vi session in both? Copy and past would be very easy this way.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2003 01:30 PM
05-27-2003 01:30 PM
Solution
Probably the best "vi" like answer is to download and install vim. It's a vi superset and will handle multiple windows.
http://gatekeep.cs.utah.edu/hppd/hpux/Editors/vim-6.1/
Plain vi can also hadle your request:
In File A:
:set number
This will display lines numbers. Let's assume that your want 50 lines beginning at line 50 AND 10 line starting at line 113 to copy into FileB.
1) position the cursor on line 50
"a50yy
50 lines "yanked into buffer "a"
2) position the cursor on line 113
"b10yy
10 lines yanked into buffer "b"
3) :e! FileB
You are now editing FileB
4) Position the cursor where you want the 50 lines inserted
"ap
5) Position the cursor where you want the 10 lines in buffer "b" inserted.
"bp
6) :set nonumber
Turns off line numbering.
http://gatekeep.cs.utah.edu/hppd/hpux/Editors/vim-6.1/
Plain vi can also hadle your request:
In File A:
:set number
This will display lines numbers. Let's assume that your want 50 lines beginning at line 50 AND 10 line starting at line 113 to copy into FileB.
1) position the cursor on line 50
"a50yy
50 lines "yanked into buffer "a"
2) position the cursor on line 113
"b10yy
10 lines yanked into buffer "b"
3) :e! FileB
You are now editing FileB
4) Position the cursor where you want the 50 lines inserted
"ap
5) Position the cursor where you want the 10 lines in buffer "b" inserted.
"bp
6) :set nonumber
Turns off line numbering.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2003 01:47 PM
05-27-2003 01:47 PM
Re: editing between two files in vi
Assuming 2 files (test and test2).
$ vi test
Within vi do ..
:e test2
and that brings up the 2nd file. To switch between these 2 files within vi do use the SHIFT+CTRL and ~ key. For example to switch back to test press and hold SHIFT and CTRL then hit ~.
Now in file test bring your cursor to the line you want to yank. Enter ..
:. y b
That copy the current line to buffer b. Switch to file test2, bring your cursor to the desire line and enter ..
:pu b
which will copy that line over to test2 (below where your cursor's at).
$ vi test
Within vi do ..
:e test2
and that brings up the 2nd file. To switch between these 2 files within vi do use the SHIFT+CTRL and ~ key. For example to switch back to test press and hold SHIFT and CTRL then hit ~.
Now in file test bring your cursor to the line you want to yank. Enter ..
:. y b
That copy the current line to buffer b. Switch to file test2, bring your cursor to the desire line and enter ..
:pu b
which will copy that line over to test2 (below where your cursor's at).
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP