Auro Ashish Saha wrote:
Hello,

Please help me to remove alternate lines from a text file.

000000 00000
123456 99999
999999 99999
123445 99999

I want to delete the line 1, 3, 5 and so on. What are the commands to be
used. Thanks for help in advance.

Regards,

Auro Ashish Saha.




Method I:

        q"ddjjq
        <count>@"

where <count> is equal to the number of lines still to be deleted

Method II (all on one line if typed on the Vim command-line):

:let i=1 | while i <= line('$') | if (i % 2) | exe i . "delete" | endif | endwhile


Best regards,
Tony.
--
Idaho state law makes it illegal for a man to give his sweetheart a box
of candy weighing less than fifty pounds.

Reply via email to