[prev in list] [next in list] [prev in thread] [next in thread]
List: vim
Subject: Re: Delete lines which match a particular regex
From: "Antoine J. Mechelynck" <antoine.mechelynck () belgacom ! net>
Date: 2005-02-22 2:12:21
Message-ID: 421A9505.2050300 () belgacom ! net
[Download RAW message or body]
Ovid wrote:
> Thanks Gavin,
>
> That solved my problem perfectly. Where in the docs would I be able to
> read more about this? I tried ":help regex", but I'm not seeing it
> there.
>
> Cheers,
> Ovid
Notice the command starts with ":g"? Try ":help :g", then if that isn't
enough, follow the |links| from there.
HTH,
Tony.
> --- Gavin Tomlins <gavint@brainandbehaviour.com.au> wrote:
>
>
>>Hi Ovid,
>>
>>To delete lines matching "XXX"
>>
>>:g/XXX/d
>>
>>To delete blank lines
>>
>>:g/^\s*$/d
>>
>>Regards
>>
>>Gavin
>>
>>-----Original Message-----
>>From: Ovid [mailto:publiustemp-vimlist@yahoo.com]
>>Sent: Tuesday, 22 February 2005 11:46 AM
>>To: vim@vim.org
>>Subject: Delete lines which match a particular regex
>>
>>Hi all,
>>
>>Let's say that I have a file and I want to delete all lines in that
>>file which contain "XXX" or all blank lines, how would I do that? In
>>other words, I don't want to just delete the data on a particular
>>line
>>or lines, but I'd like to have fewer lines when I'm done. Using the
>>shell and grep and redirecting back to the file seems silly, so I'm
>>sure there's a way I can do this in vim, yes?
>>
>>Cheers,
>>Ovid
[...]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic