The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding Multiple Lines to Multiple Files dayinthelife Shell Programming and Scripting 2 06-04-2008 08:50 AM
Edit and compare giant binary files with lfhex iBot UNIX and Linux RSS News 0 05-27-2008 01:20 AM
Locking a file when using VI to prevent multiple-edit sessions by diff users Browser_ice AIX 14 11-23-2006 07:43 AM
Searching multiple files with multiple expressions Anahka Shell Programming and Scripting 6 01-07-2004 03:24 PM
how to edit large files using vi nazri UNIX for Dummies Questions & Answers 3 06-15-2001 06:18 AM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-06-2003
Registered User
 

Join Date: Sep 2002
Location: Omaha, NE
Posts: 18
Edit Multiple Files in VI

Here's what I have...

$ vi foo1
- open foo1 and work around for a while. I yank a few lines into a buffer and then :w to save.

Next I :e foo2 to open foo2 and paste my buffer. I :w to save, but I would like to then be able to go directly back into foo1 where I was before I opened foo2. Is that possible?
Forum Sponsor
  #2  
Old 10-06-2003
criglerj's Avatar
Registered User
 

Join Date: May 2002
Location: Atlanta
Posts: 129
When yanking, put the lines you want to copy into a named buffer, then edit the other file. E.g.,
Code:
$ vi foo1
"a3yy
:e foo2
3G
"ap
:wq
Use your favorite variation on "y" and "p" commands.
  #3  
Old 10-06-2003
Registered User
 

Join Date: Sep 2002
Location: Omaha, NE
Posts: 18
Correct, but that still exits all the way out of VI. I would like to save and close the second file (foo2) and then be directly back into the first file (foo1).
  #4  
Old 10-07-2003
criglerj's Avatar
Registered User
 

Join Date: May 2002
Location: Atlanta
Posts: 129
Quote:
Originally posted by djschmitt
Correct, but that still exits all the way out of VI. I would like to save and close the second file (foo2) and then be directly back into the first file (foo1).
No problem. Change the final
Code:
:wq
to
Code:
:w
:e#
Sorry if I misread your original post.
  #5  
Old 10-07-2003
Registered User
 

Join Date: Sep 2002
Location: Omaha, NE
Posts: 18
Beauty. Thanks, criglerj.
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 08:36 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0