Using Vim to add something to the end of a series of a lines
I would like to use VIM to add something to the end of a series of lines. Ideally I could do something like add " X" (with a space before the X) to the end of lines 1-40 and 50-60 in a single command, i.e. ideally I could have a break in between where I didn't add something. If that's not possible just adding to 1-40 and 50-60 separately would work too.
I would be using bufdo to do this, but my understanding is that anything you can do in vim you can use with the bufdo command. Thanks in advance! |
For the single range of lines:
Code:
:1,40s/$/ X/ |
Thanks, that's a huge help. I think that resolves things.
|
You can also do it with sed:
Code:
sed '1,40 s/.*/& X/ ; 50,60 s/.*/& X/' |
All times are GMT -5. The time now is 10:49 PM. |