Monday, 5 October 2009
Join Pairs of Lines
Compress every other line
Bob
Jones
Mary
Quite-contrary
:g//,//j
Bob Jones
Mary Quite-contrary
Now if there are empty lines eg
Bob
Jones
Mary
Quite-contrary
use
:g/./,/./j
or slightly tighter
:g/\w/,/\w/j
and to limit it to a range of lines (between markers a and b)
:'a,'bg/\w/,/\w/j
Tip from James Church
Bob
Jones
Mary
Quite-contrary
:g//,//j
Bob Jones
Mary Quite-contrary
Now if there are empty lines eg
Bob
Jones
Mary
Quite-contrary
use
:g/./,/./j
or slightly tighter
:g/\w/,/\w/j
and to limit it to a range of lines (between markers a and b)
:'a,'bg/\w/,/\w/j
Tip from James Church
Labels: join lines
Subscribe to Posts [Atom]
Post a Comment