LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   select in vi (https://www.linuxquestions.org/questions/linux-newbie-8/select-in-vi-558507/)

adnanm 06-02-2007 12:28 AM

select in vi
 
Hi,

I would like to select a block of line in vi editor, from line 24510 to 36542.

Any ideas?

jstephens84 06-02-2007 12:51 AM

Try shift+v then use the arrow keys to highlight lines.

adnanm 06-02-2007 01:03 AM

jstephens84:

Thank you but in fact I got over 10k of lines.

So what I need is a command to do it from once.

jschiwal 06-02-2007 01:10 AM

You can prepend commands with the line range.
:24510,36542s/^/\t/
will insert a tab on the range 24510-36542.
:24510,36542y
will yank this range of lines. You could also use cut instead and then 'p' paste them somewhere.

adnanm 06-02-2007 01:27 AM

jschiwal:

How to use cut? That is what I need.

jschiwal 06-02-2007 05:36 AM

You can use :delete followed by :paste
:10,20d
50G
]p

The :10,20d command will delete the lines from 10-20 inclusive.
Entering 50G will go to line 50.
] goes to the end of line 50
p pastes what you deleted.


All times are GMT -5. The time now is 11:04 PM.