Ok, this has been bugging me for a while, and is probably obvious, but: using VI, how do you remove blank lines, i.e. carriage returns/paragraph marks? Editting a big alias file has brought this to a head... Cheers Chris
On Wednesday 05 June 2002 3:34 pm, Chris Puttick wrote:
Ok, this has been bugging me for a while, and is probably obvious, but: using VI, how do you remove blank lines, i.e. carriage returns/paragraph marks? Editting a big alias file has brought this to a head...
Cheers
Chris
Hi Chris, The way I do it is to record/playback a little macro. Below is the macro and a description (bit before tab = macro, bit after tab = description, <cr> = enter key) qq record macro 'q' /^$<cr> search for next blank line dd delete it q end recording macro 999@q replay macro 'q' 999 times. The macro stops at the first error, i.e. the first time it can't find a blank line. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
On Wednesday 05 June 2002 3:44 pm, Gary Stainburn wrote:
On Wednesday 05 June 2002 3:34 pm, Chris Puttick wrote:
Ok, this has been bugging me for a while, and is probably obvious, but: using VI, how do you remove blank lines, i.e. carriage returns/paragraph marks? Editting a big alias file has brought this to a head...
Cheers
Chris
Hi Chris,
The way I do it is to record/playback a little macro. Below is the macro and a description (bit before tab = macro, bit after tab = description, <cr> = enter key)
qq record macro 'q' /^$<cr> search for next blank line dd delete it q end recording macro 999@q replay macro 'q' 999 times.
The macro stops at the first error, i.e. the first time it can't find a blank line.
Sorry 'bout this, but forgot a bit. if the blank lines are not actually blank, but have whitespaces in them (space, tab etc), then replace the above search with /^\s*$ which translates to any line starting at the beginning ending at the end which only whitespace seperating them. -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
participants (2)
-
Chris Puttick
-
Gary Stainburn