Quote:
I remember you can open multiple file with vi and switch between this files. How do you do it?
|
Here are a couple of examples of that, don't know about the other questions.
Code:
Use yank (y) and paste (p) to copy data from file.txt into file1.txt.
1: vi file.txt # Open a file
2: :1,4y # Copy lines 1 thru 4
3: :e! file1.txt # This opens up the second file
4: p # Paste the buffer into the second file
5: :w! # Save changes to second file
6: :e! file.txt # Return to the first file
Search for a pattern, then
use yank (y) and paste (p) to copy data from file.txt into file1.txt.
1: vi file.txt # Open a file
2: /now # Search for now
3. y3w # Copy three words from the search position.
4: :e! file1.txt # This opens up the second file
5: p # Paste the buffer into the second file
6: :w! # Save changes to second file
7: :e! file.txt # Return to the first file