vi 편집기의 ex 명령을 사용해서 파일 내용을 수정해 봅시다. 다시 BallGame 파일을 편집기로 엽니다.

    supreme@master:~$ vi BallGame

    :을 눌러 ex 명령을 작성합니다. ex 명령은 범위를 지정하고 명령을 적용하는 방식으로 동작합니다. 10번 줄을 3번으로 옮기는 명령(move)입니다.

    ~
    :10m3

    마지막 줄(10번)이 3번 줄로 옮겨졌습니다.

    Take me out to the ball game
    
    Take me out to the ball game
    Take me out with the crowd and crackerjacks
    Buy me some peanuts and crackerjacks
    I don't care if I never get back
    Let me root, root, root for the home team
    If they don't win it's a shame
    For it's one, two, three strikes
    you're out at the old ball game

    ‘[시작 행 번호],[끝 행 번호]’ 형태로 명령을 적용할 줄을 선택할 수도 있습니다. 3번과 4번 줄을 복사(copy)해서 10번 줄 뒤에 붙입니다.

    ~
    :3,4co10
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.