Find the answer to your Linux question:
Results 1 to 9 of 9
cmd : vi file1 file2 file3 the above command creates three files ie.file{1,2,3} but once inside the vi after writing text in the first file how do I move onto ...
  1. #1
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    [SOLVED] vi multiple file's

    cmd : vi file1 file2 file3
    the above command creates three files ie.file{1,2,3}
    but once inside the vi after writing text in the first file how do I move onto 2 and so forth

  2. #2
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    Use the -o option when running vi:

    Code:
    vi -o file1 file2 file3
    Then use the key sequence ^m^j to move forward to the next file.
    Use ^m^k to move back to the previous file.
    To write all three file when exiting use the command: :wqa

  3. #3
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Location
    Mountain View, CA
    Posts
    132

  4. #4
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    what is ^j^m

    hey thanks for your reply
    but i didn'y understand what is ^j^m
    is it cntrl + j +m
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  5. #5
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    It should be Ctrl+j and Ctrl+m.
    I don't have to access to Linux box right now and can't confirm it.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  6. #6
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    cntrl+j and cntrl+m
    but form where i.e form insert mode or form :
    I hear the beep all the time!!!
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  7. #7
    Linux Newbie egan's Avatar
    Join Date
    Feb 2009
    Location
    Mountain View, CA
    Posts
    132
    Try bn and bp for buffernext and bufferprevious in ex mode.

  8. #8
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    can u please out some light wat is ex mode and bn and bp mode
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  9. #9
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    finally got the solution. Open all the files in vi that u want to edit by passing the name of the file as arguments.
    eg: vi file1 file2 file3
    then to sift to the next file simply type":n" and enter. There you are on the other file. This link may be helpful Working With Multiple Files in vi
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...