And how about deleting from line L1 for instance to the end of
the file. And put it in a script file, since "G" don't appear
like a regexp and $ represent end of line if I'm not wrong ?


$ represents the end-of-line in *normal* mode. As an Ex command, it means the last line in the file. Thus, you'd use

        :42,$d

to delete from line 42 to the end of the file.

I highly recommend reading the help found at

        :help :range

where you'll learn all sorts of handy ways for referring to lines in an ex command. Commands/addresses can be chained so you can end up with things like

        :1/APPENDIX/?CHAPTER?+2

which would refer to "two lines after (+2) the line that contains "CHAPTER" that occurs before the first line containing the word "APPENDIX". All sorts of complex references and ranges can be created from a few simple addressing schemes.

-tim


Reply via email to